Mid JavaScript

What are ES6 modules?

ES6 introduced modules for code reusability and organization.

They use export and import keywords.

Example:

// math.js

export function add(a, b) { return a + b; }

// main.js

import { add } from './math.js';

More from JavaScript Tutorial

All questions for this course