Skip to content

JavaScript basics: a five-step tutorial

These five tutorials teach the core of the JavaScript language from the beginning. Each one covers several related topics, explains them in plain words, and shows runnable samples from one invented online shop, OrdersPortal, with their real output. Read them in order: each page builds on the one before it.

You only need Node.js 22 to follow along. Save a sample as a .mjs file and run it with node sample.mjs.

Step Tutorial Topics
1 Values, types and operators Variables and data types, operators, type coercion, truthy and falsy values.
2 Control flow, errors and async basics Conditionals and loops, error handling, console debugging, asynchronous code.
3 Functions, scope and closures Functions, scope, hoisting, closures, the this keyword.
4 Objects, arrays and JSON Objects, arrays and array methods, prototypes, JSON.
5 Strings, numbers and dates Strings, numbers and Math, dates and time zones, regular expressions.
  1. Core language: the modern syntax you will see in every codebase.
  2. Async and modules: promises, async/await and modules in depth.
  3. Objects and collections: Map, Set, symbols, proxies, iterators and generators.
  4. JavaScript features: every feature page, by topic and edition.