JavaScript

The programming language of the web, used in browsers and on servers.

JavaScript is the language every web browser runs, so it is how web pages become interactive. With Node.js it also runs on servers, in command-line tools and in desktop and mobile apps.

  • Beginner
  • 18 lessons
  • 23 exercises
  • Runs in your browser
Not started yet0 of 23 exercises solved
Start lesson 1

Lessons

  1. Hello, World!You will print your first message and see the two places JavaScript runs: the browser console and Node.js. You can try it now by opening DevTools (F12) and clicking Console.1 exercise
  2. Variables & TypesYou will learn how to store values with let and const, what types JavaScript has, and why === is safer than ==. These basics appear in every program you write.2 exercises
  3. Control Flow & LoopsYou will learn how to make decisions with if and switch and how to repeat work with loops and array methods. This is how a program reacts to different data.2 exercises
  4. Functions & Arrow FunctionsYou will learn the different ways to write functions, including arrow functions, which are the most common in modern code. Functions let you name a piece of work and reuse it.2 exercises
  5. Arrays & ObjectsYou will learn how to store lists in arrays and named values in objects, and how to work with both. Most data in JavaScript programs is held in these two structures.2 exercises
  6. Classes & ModulesYou will learn how to define classes and split code into modules. Classes group data with the functions that act on it, and modules keep larger programs organised.2 exercises
  7. Promises & Async/AwaitYou will learn how JavaScript waits for slow work such as network requests without freezing, using promises and async/await. Almost every real app needs this.1 exercise
  8. Mini Project: Fetch & Display DataYou will build a Node.js script that fetches data from a public API and prints it neatly. It brings together network requests, JSON and async/await.
  9. Closures & ScopeYou will learn how scope decides where a variable can be used, and how a closure lets a function keep access to variables from where it was created. Callbacks, event handlers and many common patterns rely on this.2 exercises
  10. Destructuring, Spread & RestYou will learn how to pull values out of arrays and objects with destructuring, and how to copy and combine them with spread and rest. These make everyday code shorter and clearer.2 exercises
  11. DOM & EventsYou will learn how to find, change and create elements on a web page and respond to clicks and other events. This is how JavaScript makes a page interactive.
  12. Modules & npmYou will learn how to split code across files with import and export, and how to add packages from npm. Both matter as soon as a project grows beyond one file.
  13. Error Handling & DebuggingYou will learn how to catch and throw errors, including errors from async code. Handling errors well keeps a program from failing silently or crashing.2 exercises
  14. Fetch & Working with APIsYou will learn how to send HTTP requests with fetch and handle the responses correctly, including the fact that a 404 does not throw an error. Most apps need to talk to a server.
  15. Iterators, Generators & SymbolsYou will learn the iteration protocol that for...of, spread and destructuring use, and how generators make it easy to implement. With it, your own objects can be looped over like arrays.2 exercises
  16. "this", Prototypes & the Object ModelYou will learn how prototypes work underneath classes and how JavaScript decides what "this" refers to. This explains many behaviours that otherwise look surprising.1 exercise
  17. Regular ExpressionsYou will learn how to describe text patterns with regular expressions and use them to validate, extract and replace text. One pattern can replace many lines of manual string handling.2 exercises
  18. JavaScript CheatsheetModern JS on one page — ES6+ syntax, arrays, async, DOM.

Install it on your own computer

Every web browser can already run JavaScript, so you can start straight away. To run JavaScript files outside the browser, install Node.js. You do not need this to follow the lessons: the examples run in your browser.

Bash
# Download Node.js from nodejs.org
# Get the LTS (Long Term Support) version

# Or use winget:
winget install OpenJS.NodeJS.LTS

# Verify:
node --version
npm --version

What people build with JavaScript

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Create interactive browser experiences
  • Build full-stack web applications
  • Automate browsers and workflow scripts
  • Develop desktop and mobile apps with web technology

Projects to try

  1. Pomodoro timer
  2. Weather dashboard
  3. Collaborative kanban board
  4. Offline-first personal finance PWA

Common tools and packages

npmExpressNext.jsViteVitestPlaywrightElectronReact Native

Well-known software

DiscordSlackVisual Studio CodeNotionFigma web appPostman