Learn JavaScript

The language of the web, running in every browser and on servers via Node.js

45 lessons · 9 hours · 4 levels · covers JavaScript ES2025

JavaScript (standardised as ECMAScript) is a dynamic, multi-paradigm language that runs in every web browser and, through runtimes like Node.js, Deno and Bun, on servers and tooling too. It powers interactive pages, web apps, APIs and build tools, and it is the foundation for TypeScript, React and most of the modern web stack.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics15 lessons · 2 hours in total
2. PracticalUse it productively at work, with the usual idioms30 lessons · 5 hours in total
3. AdvancedThe less common features, performance and trade-offs39 lessons · 8 hours in total
4. ExpertInternals and the edge cases experts know45 lessons · 9 hours in total

The JavaScript tree

JavaScriptRunning JavaScriptRunning JavaScriptValues and typesValues and typesVariables: let and constVariables: let andconstOperators and equalityOperators andequalityStrings and template literalsStrings and templateliteralsNumbers, Math and BigIntNumbers, Math andBigIntConditionalsConditionalsLoopsLoopsFunctionsFunctionsArrow functionsArrow functionsArraysArraysObjectsObjectsOptional chaining and ??Optional chaining and??The DOM: finding and changing elementsThe DOM: finding andchanging elementsHandling eventsHandling eventsArray methods: map, filter, reduceArray methods: map,filter, reduceDestructuring, spread and restDestructuring,spread and restScope and hoistingScope and hoistingClosuresClosuresHow this worksHow this worksClassesClassesError handlingError handlingModules: import and exportModules: import andexportWorking with JSONWorking with JSONMap and SetMap and SetEvent propagation and delegationEvent propagationand delegationCallbacks and timersCallbacks and timersPromisesPromisesasync and awaitasync and awaitMaking HTTP requests with fetchMaking HTTPrequests with fetch
Essentials and Practical shown (30 of 45 lessons); the full list is below. Click a lesson to read it.

All 45 lessons, in order

Getting started

  1. Running JavaScript · Essentials · 8 min

    Run your first JavaScript in the browser console, in a web page and with Node.js.

  2. Values and types · Essentials · 10 min

    The seven primitive types, objects, typeof, and which values count as truthy or falsy.

  3. Variables: let and const · Essentials · 8 min

    Declare variables with const and let, know what var does differently, and what const really protects.

  4. Operators and equality · Essentials · 10 min

    Arithmetic, comparison and logical operators, and why you use === instead of ==.

  5. Strings and template literals · Essentials · 10 min

    Create strings, interpolate with template literals and use the everyday string methods.

  6. Numbers, Math and BigInt · Essentials · 10 min

    How JavaScript numbers work, parsing and formatting them, and when you need BigInt.

  7. Conditionals · Essentials · 8 min

    Branch with if/else, the ternary operator and switch.

  8. Loops · Essentials · 10 min

    Repeat work with for, while, for...of and for...in, and control it with break and continue.

Functions, scope and modules

  1. Functions · Essentials · 12 min

    Declare functions, pass parameters with defaults, return values and treat functions as values.

  2. Arrow functions · Essentials · 8 min

    Write compact functions with =>, use implicit returns and know how arrows differ from regular functions.

  3. Scope and hoisting · Practical · 10 min

    Understand lexical scope, block vs function scope, hoisting and the temporal dead zone.

  4. Closures · Practical · 12 min

    Functions remember the variables of the scope they were created in — use that for private state and factories.

  5. How this works · Practical · 12 min

    Learn the rules that decide what this refers to, and how call, apply, bind and arrows change it.

  6. Error handling · Practical · 12 min

    Throw and catch errors, clean up with finally, create custom error types and add causes.

  7. Modules: import and export · Practical · 12 min

    Split code into ES modules with named and default exports, static and dynamic imports.

Objects and collections

  1. Arrays · Essentials · 10 min

    Create arrays, read and update elements, and add, remove and find items.

  2. Objects · Essentials · 12 min

    Group related data in objects: create them, read and update properties, add methods and iterate.

  3. Optional chaining and ?? · Essentials · 7 min

    Safely read through possibly-missing values with ?. and supply defaults with ?? and ??=.

  4. Array methods: map, filter, reduce · Practical · 15 min

    Transform, filter, search, sort and group arrays with callback-based methods instead of hand-written loops.

  5. Destructuring, spread and rest · Practical · 12 min

    Unpack arrays and objects into variables, and use ... to copy, merge and collect values.

  6. Working with JSON · Practical · 8 min

    Convert between JavaScript values and JSON text with JSON.stringify and JSON.parse, and know what gets lost.

  7. Map and Set · Practical · 10 min

    Use Map for key–value lookups with any key type and Set for unique values, including the new set operations.

  8. Immutability and copying · Advanced · 12 min

    Avoid accidental mutation with change-by-copy methods, structuredClone and Object.freeze — and know their limits.

The browser and the DOM

  1. The DOM: finding and changing elements · Essentials · 12 min

    Select elements with querySelector, change their text, classes and attributes, and create new ones.

  2. Handling events · Essentials · 12 min

    React to clicks, input and form submissions with addEventListener and the event object.

  3. Event propagation and delegation · Practical · 10 min

    Understand capture and bubbling, target vs currentTarget, and handle many elements with one listener.

Classes and prototypes

  1. Classes · Practical · 15 min

    Define classes with constructors, methods, fields, private members, static members and inheritance.

  2. Prototypes and inheritance · Advanced · 15 min

    See how property lookup walks the prototype chain and how classes, Object.create and built-ins fit on top of it.

Asynchronous JavaScript

  1. Callbacks and timers · Practical · 10 min

    Schedule work with setTimeout and setInterval and see why JavaScript code never blocks waiting.

  2. Promises · Practical · 15 min

    Represent future results with promises: chain then/catch/finally and combine them with Promise.all and friends.

  3. async and await · Practical · 15 min

    Write asynchronous code that reads top to bottom with async functions, await and try/catch.

  4. Making HTTP requests with fetch · Practical · 12 min

    Request data from APIs with fetch, handle HTTP errors properly, send JSON and cancel requests.

  5. The event loop and microtasks · Advanced · 15 min

    Understand the call stack, task queue and microtask queue, and predict the order async code runs in.

  6. Async iteration and async generators · Advanced · 12 min

    Consume streams of asynchronous values with for await...of and produce them with async generators.

Advanced language features

  1. Iterators and generators · Advanced · 15 min

    Implement the iteration protocol, write generator functions with yield and chain lazy iterator helpers.

  2. Symbols and well-known symbols · Advanced · 10 min

    Create collision-free property keys with Symbol and customise language behaviour via well-known symbols.

  3. Proxy and Reflect · Advanced · 15 min

    Intercept fundamental object operations with Proxy traps and forward them correctly with Reflect.

  4. Regular expressions · Advanced · 15 min

    Match, extract and replace text with regular expressions, named groups and flags.

  5. Spec semantics: coercion and edge cases · Expert · 15 min

    Reason precisely about ToPrimitive, + and ==, -0 and NaN, SameValueZero and property order using the spec's abstract operations.

Performance and engine internals

  1. Measuring and improving performance · Advanced · 15 min

    Profile before optimising, measure with the Performance API and fix the usual culprits: algorithms, layout and the main thread.

  2. How engines run JS: parsing and JIT tiers · Expert · 15 min

    Follow code from source to bytecode to optimised machine code, and see what makes engines speculate and deoptimise.

  3. Hidden classes and inline caches · Expert · 15 min

    Learn how engines give objects shapes, cache property lookups per call site, and what makes code polymorphic or megamorphic.

  4. Garbage collection and memory leaks · Expert · 15 min

    How engines reclaim memory by reachability, how generational GC works, and how to find and fix leaks.

  5. Realms, agents and the execution model · Expert · 12 min

    Learn the spec's model of realms, agents and job queues, and why instanceof fails across iframes.

  6. SharedArrayBuffer and Atomics · Expert · 20 min

    Share memory between workers with SharedArrayBuffer, avoid data races with Atomics, and coordinate with wait/notify.