Aliases on import in JavaScript

You can rename functions on import. This is done with the as command. For example, let's rename the root2 function to sqrt function:

import {root2 as sqrt, root3} from './math.js';

Let's check the code:

let res = sqrt(2) + root3(3); console.log(res);

When importing your module, rename the pow2 function to square and the pow3 function to cube.

enru