Structure JavaScript code with ES modules and classes

8 steps · about 2 h 30 min · Beginner

  1. Split code into modules (article, javascript.info, 30 min)

    Explains import, export and how browsers load modules.

  2. Know every form of import (article, MDN, 15 min)

    Clarifies named, default and namespace imports.

  3. Write your first classes (article, MDN, 25 min)

    Shows constructors, methods and instances with modern syntax.

  4. Hide state with private fields (article, MDN, 15 min)

    Teaches true encapsulation with #names.

  5. Add static members (article, MDN, 10 min)

    Shows how to attach helpers to the class itself.

  6. Unpack values with destructuring (article, MDN, 20 min)

    Makes function arguments and imports shorter and clearer.

  7. Copy and merge with spread (article, MDN, 15 min)

    Gives the standard way to clone arrays and objects.

  8. Compare with a second classes tutorial (article, javascript.info, 20 min)

    A different explanation that reinforces class patterns.