Structure JavaScript code with ES modules and classes
8 steps · about 2 h 30 min · Beginner
- Split code into modules (article, javascript.info, 30 min)
Explains import, export and how browsers load modules.
- Know every form of import (article, MDN, 15 min)
Clarifies named, default and namespace imports.
- Write your first classes (article, MDN, 25 min)
Shows constructors, methods and instances with modern syntax.
- Hide state with private fields (article, MDN, 15 min)
Teaches true encapsulation with #names.
- Add static members (article, MDN, 10 min)
Shows how to attach helpers to the class itself.
- Unpack values with destructuring (article, MDN, 20 min)
Makes function arguments and imports shorter and clearer.
- Copy and merge with spread (article, MDN, 15 min)
Gives the standard way to clone arrays and objects.
- Compare with a second classes tutorial (article, javascript.info, 20 min)
A different explanation that reinforces class patterns.