ES module import in JavaScript

Let's now include a module in another file. This is done with the commands import and from.

After the import command, names of the imported functions should be written in curly brackets. And after the command from - a path to the imported file.

In our case, we will import the functions root2 and root3:

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

After such an import, the root2 and root3 functions will be available to us. Let's use them:

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

Import the module you created in the previous lesson. Test your imported functions.