JavaScript
Learn JavaScript from your first line to classes and async code, then bring a web page to life with it.
Each lesson has runnable examples and exercises. JavaScript is real (Node.js 24), running in a small Linux machine inside this tab: no install, no server running your code. The first visit downloads about 30 MB, of which the first 5 MB before you can start; later visits start from your browser's copy.
Linux + Node.js 24 in your browser
23 lessons · 208 programs
Chapter 1 · Foundations
What runs your program; numbers, text and errors
- 1 Hello, JavaScript
Your first program, the command that runs it, and console.log.
- 2 Inside the computer
What a computer is made of, what happens when your program runs, and where its values live in memory.
- 3 Values and variables
let and const, numbers and arithmetic, typeof, and the numbers that surprise.
- 4 Text
Strings, + with text, template literals, Number(), toFixed and your first methods.
- 5 Reading errors
Syntax errors, stack traces, and the mistakes that print no error.
Chapter 2 · Decide, repeat, reuse
Decisions, loops, functions, modules and input
- 6 Decisions and loops
if, else if and else, for and while, the classic FizzBuzz, and a test of it all.
- 7 Functions
Your own functions, return, a frame per call, arguments, scope and arrow functions.
- 8 Modules and input
Programs in several files with import and export, what Node gives you, random numbers, files and input.
Chapter 3 · Data
Text, arrays, objects, callbacks, maps and recursion
- 9 Working with text
Characters by index, slices, methods that make new text, split and join, and columns that line up.
- 10 Arrays
Lists of values in order, loops over them, two names for one array, copies, and grids.
- 11 Objects
Values by name, missing values, every key and value, records, shared and copied objects, and JSON.
- 12 Callbacks: functions on arrays
forEach, map, filter, find, reduce and sort, each given a function to call.
- 13 Maps and sets
Look values up by key with a Map, count with it, and keep each value once with a Set.
- 14 Recursion
Functions that call themselves, the base case that stops them, and the stack they fill.
Chapter 4 · Real programs
Closures, prototypes, classes, exceptions, async code and a console tool
- 15 Closures
Functions that keep their variables after the call that made them has returned.
- 16 Prototypes: objects that share
Methods and this, the hidden link to a prototype, and where push and map really live.
- 17 Classes
A class builds lesson 16's links for you; private fields, extends and super.
- 18 Exceptions
Throw an error, catch it with try and catch, make your own kind, and survive bad input and missing files.
- 19 Waiting: the event loop
Timers, the event loop, promises, async and await, and files read and written without stopping the program.
- 20 A console project of your own
Finish a to-do tool of four modules that reads commands, keeps tagged tasks in a JSON file and prints a report.
Chapter 5 · The web page
HTML, CSS, the DOM, events and a page of your own
- 21 A web page
HTML elements, CSS rules, and a script that finds, changes and builds the page's elements.
- 22 Events
Handlers for clicks, typing and forms; state in variables, and a render() that redraws the page from it.
- 23 A page of your own
Lesson 20's to-do list as a page, run by the same tasks.js: render, add, mark done, filter and count.