JavaScript modules (also known as ES modules or ECMAScript modules) were created to help make JavaScript code more organized and maintainable.
Understanding how ES modules work will help you become a better JavaScript developer. In this article, we’ll cover:
- What is a module?
- What are ES modules? Why do we use them?
- How to use ES modules
- Other module systems used in JavaScript
Madison Kanna’s excellent introduction to standardized JavaScript module syntax. Of particular note, the syntax for importing from a file that includes both a default and additional named exports:
import add, { multiply, subtract } from './math.js';