Intermediate level · Module 1 of 6 · 15 guided hours
Modern JavaScript Syntax and Modules
Write concise modern JavaScript with spread, rest, optional chaining and classes, and organise code into ES modules.
Learning objectives
- Use spread, rest, destructuring, optional chaining and nullish coalescing
- Write classes and understand prototypes
- Split code into ES modules with import and export
Topics
- spread and rest
- optional chaining ?. and nullish ??
- classes, getters and private fields
- prototypes
- import and export
- module scope
Lessons
-
Lesson 1 Spread, Rest and Safe Property Access
Copy and combine arrays and objects with spread, collect arguments with rest, and read nested data safely.
spread ...rest parametersoptional chaining ?.nullish coalescing ??
-
Lesson 2 Classes and Prototypes
Model data and behaviour with classes, getters and private fields, and understand the prototypes underneath.
class and constructorgetterprivate field #prototype
-
Lesson 3 ES Modules
Split code into modules with import and export and load them in the browser and Node.js.
export and export defaultimporttype="module"module scope
Practical activity
Refactor a single-file script into modules: a data module, a formatting module and a UI module, using modern syntax throughout.
Expected outcomes
- Concise, modern code
- Projects organised into modules
Assessment
Refactoring practical: the refactored project must behave identically and pass a checklist of modern-syntax and module rules.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.