Question 8 of 10Pro Only
Explain ES6 modules in JavaScript. What are the differences between export default and named exports? How does tree-shaking work?
Sample answer preview
ES6 modules allow splitting code into reusable files with a native import and export system. Named exports allow exporting multiple values from a module. // math.js export const PI = 3.14159; export function add(a, b) { return a + b; } export function multiply(a, b) { return a *…
ES6 modulesimportexportdefault exportnamed exporttree-shaking