Learn JavaScript

From zero to how the language really works

A free JavaScript course in short animated videos, each with a written explanation. It starts from zero and goes deeper with every lesson: values and types, functions, closures, arrays and objects, the this keyword, classes, prototypes, modern syntax and error handling.

19 lessons187 min of videoFree

Lessons

Built to be followed in order

  1. 8:11

    Lesson 1

    What is JavaScript?

    Who JavaScript was built for and why it was written in ten days, why it lets so many mistakes through, why it can't take back its old decisions, and how it reached far beyond the browser.

  2. 9:22

    Lesson 2

    JavaScript data types and operators

    How a row of zeros and ones becomes a value with a type, what operators do with those values, and why JavaScript says 0.1 + 0.2 isn't 0.3.

  3. 9:49

    Lesson 3

    JavaScript basics: variables, conditions, loops and functions

    What a program is made of, how it remembers values, makes decisions and repeats itself, what a function is, and why putting a return value on the next line makes the function return undefined.

  4. 9:07

    Lesson 4

    JavaScript closures and scope

    Three ways to write a function, where a variable lives, how a closure keeps one alive after its function has returned, what a function can do with another function, and why a function that calls itself can run out of stack.

  5. 9:52

    Lesson 5

    JavaScript arrays and objects

    How arrays hold a list and objects hold values by name, how they nest, why two variables can share one object and a const object can still change, how forEach, map, filter and reduce work through a list with a callback, and why sort puts 10 before 2 until you hand it one.

  6. 8:42

    Lesson 6

    The JavaScript this keyword

    How a function kept in a property becomes a method, what the word this means inside it (whatever is left of the dot), why a method handed to setTimeout prints undefined, how an arrow function or bind brings the object back, and what it means that arrow functions have no this of their own.

  7. 10:03

    Lesson 7

    JavaScript classes and prototypes

    How a class works as a blueprint and what new does when it builds an object from one, where methods really live (the prototype, and the chain JavaScript climbs to find them), why two different arrays share a single push, and how extends, super and instanceof follow from that chain.

  8. 10:05

    Lesson 8

    JavaScript ES6+ features

    The shorter ways modern JavaScript writes everyday code: template literals for strings, destructuring to pull values out of objects and arrays, the three dots of spread and rest (and why a spread copy only goes one level deep), and optional chaining and nullish coalescing for values that might be missing.

  9. 9:28

    Lesson 9

    JavaScript error handling

    How to read a JavaScript error (its name, its message and the stack trace), how to throw one of your own, how try, catch and finally keep one error from stopping the whole program, and how strict mode turns silent mistakes, like a misspelled variable, into errors.

  10. 12:00

    Lesson 10

    Asynchronous JavaScript

    Why a timer set to zero milliseconds still runs last: the call stack, the task queue and the event loop. Then callbacks, promises, and async and await, each run through the event loop step by step: callback hell, the microtask queue, promise chains, try and catch with await, and Promise.all.

  11. 9:37

    Lesson 11

    JavaScript modules

    Why two script files that never mention each other can break each other, and how modules fix it: module scope, export and import, named and default exports, how modules load and run once, live bindings, require and CommonJS in Node, and packages.

  12. 9:43

    Lesson 12

    JavaScript iterators and generators

    Why a for...of loop walks an array and a string but throws "is not iterable" on a plain object, and how to fix it: the iteration protocol, Symbol.iterator, writing an iterator by hand, generators with function* and yield, spread and destructuring, and Map and Set.

  13. 9:34

    Lesson 13

    JavaScript DOM manipulation

    What the DOM is and how JavaScript changes a page through it: the tree a browser builds from HTML, document and querySelector, textContent against innerHTML, attributes, querySelectorAll and NodeList, classList, createElement and append, and why a script in the head finds null.

  14. 9:53

    Lesson 14

    JavaScript event listeners

    How a page reacts to a click or a key: addEventListener and the function you hand it, the event object, event bubbling and event delegation, 'this' and closures in a listener, keydown and input events, and preventDefault for the browser's default actions.

  15. 9:37

    Lesson 15

    JavaScript Fetch API

    How a page gets data without reloading: the Fetch API and the HTTP request behind it, the promise fetch returns and why the body takes a second await, JSON with JSON.parse and JSON.stringify, sending data with POST, CORS and the same-origin policy, and why a 404 doesn't make fetch fail.

  16. 10:46

    Lesson 16

    Cookies vs localStorage vs sessionStorage

    The four places a browser keeps a page's data, and where a login token belongs: localStorage and the table of strings behind it, why it needs JSON, sessionStorage for a single tab, IndexedDB for real objects and large data, cookies that travel to the server (document.cookie, Set-Cookie and HttpOnly), and how to choose between them.

  17. 11:49

    Lesson 17

    Node.js

    What Node.js is: the engine from Chrome with your computer around it in place of a page. The REPL, the process object, the core modules (fs for files, path, streams, and http for a server built from one function), how the event loop and non-blocking I/O let a single thread serve many requests, and installing a package with npm.

  18. 9:27

    Lesson 18

    JavaScript build tools

    The tools around the language, on one small checkout page: npm scripts that name a project's commands, a test with Node's own test runner, a linter and a formatter, TypeScript's type checker, and a bundler (Vite) that follows every import and writes the one small file the browser gets, with tree shaking, minifying and source maps on the way.

  19. 10:02

    Lesson 19

    Build a JavaScript app

    The last episode of Learn JavaScript. Build a typing test from an empty folder, with a page, browser storage and a Node server: letters that turn red and green as you type, a timed round, a tested score, a personal best that survives a reload, and a leaderboard every browser shares. Then stop the server in the middle of a round and see what still works.