Combination of exports in JavaScript
You can combine default exports and regular exports:
src/test.jsexport function func1() {
return '1'
}
export function func2() {
return '2'
}
export default function() {
return 'text';
};
Let's do the import:
src/index.jsimport test, {func1, func2} from './test.js';
We check a default function:
src/index.jslet res = test();
console.log(res);
And check a work of other functions:
src/index.jslet res1 = func1();
let res2 = func2();
console.log(res1, res2);
Задание 1
Create a module that exports one default function and a few more functions.