Browse JavaScript Topics ▼

ES Modules (import & export)

📂 Modern ECMAScript 📘 Lesson 14 of 23

Organize code into clean modular files using ES Modules (ESM) with named and default exports.

ES Modules (import & export) is an essential topic in JAVASCRIPT.

Overview

Mastering es modules (import & export) provides the core mental model and practical skills needed for modern frontend and backend full-stack engineering.

// math.js
export const add = (a, b) => a + b;
export default class Calculator {}

// main.js
import Calculator, { add } from './math.js';

Key Concepts

  • Understand the fundamental syntax, conventions, and mental model.
  • Avoid common traps, edge cases, and performance pitfalls.
  • Apply practical idioms directly in production applications.

[!TIP] Practice these core patterns thoroughly. Next, proceed to js-classes-inheritance.

Test your understanding of ES Modules (import & export)

Quick interactive practice questions with instant feedback.

Take Quiz →