Export by default in JavaScript
Only one value can be exported from
an ES module. This is done with the
export default command. When
exporting using this command, it is
the imported value that will get
into the variable when importing
a module.
Let's look at examples. We export one function:
src/test.jsexport default function() {
return 'text';
};
Let's do the import:
src/index.jsimport test from './test.js';
We check the function:
src/index.jslet res = test();
console.log(res);
Задание 1
Create a module that exports a single function.