JavaScript

Explain ES6 module system

Medium
4
Added
Native module system using import/export with static analysis for tree-shaking.

Solution Code

JavaScript
// math.js
export const add = (a,b) => a + b;
// app.js
import { add } from './math';
Explanation
Modules are in strict mode by default. Support both named and default exports.

Guided Hints

Compare with CommonJS
What is dynamic import?