Free tutorial · 44 lessons

JavaScript Tutorial

Learn modern JavaScript step by step: variables, strings, arrays, objects, functions, closures, classes, promises, async/await, JSON, regular expressions and the DOM — with examples you can edit and run in your browser.

Start learning →

JavaScript Basics

  1. JavaScript Introduction — What JavaScript is, where it runs and why every web developer needs it.
  2. JavaScript Get Started — Run JavaScript in the browser, in a web page and with Node.js.
  3. JavaScript Syntax — Statements, semicolons, code blocks and case sensitivity.
  4. JavaScript Comments — Single-line and multi-line comments, and when to write them.
  5. JavaScript Variables — Declare variables with let and const — and why to avoid var.
  6. JavaScript Data Types — Strings, numbers, booleans, null, undefined, objects — and typeof.
  7. JavaScript Numbers — Integers, decimals, NaN, rounding and converting text to numbers.
  8. JavaScript Strings — Create strings, join them, use template literals and escape characters.
  9. JavaScript String Methods — Search, slice, replace, split, trim and pad strings.
  10. JavaScript Booleans — true, false, comparisons and truthy and falsy values.
  11. JavaScript Operators — Arithmetic, assignment, comparison, logical and nullish operators.
  12. JavaScript Type Conversion — Convert between strings, numbers and booleans — and avoid implicit coercion traps.
  13. JavaScript History & Versions — How JavaScript was created in ten days at Netscape, why its standard is called ECMAScript, every edition from ES1 to ES2026 on one timeline, what ES2015 changed, and how new features reach your browser today.

Control Flow

  1. JavaScript If Else — Run code conditionally with if, else if and else.
  2. JavaScript Switch — Choose between many cases with switch — and don't forget break.
  3. JavaScript Loops — Repeat code with for, while and do...while; control loops with break and continue.
  4. JavaScript for...of and for...in — Loop over array values, string characters and object keys.

Functions

  1. JavaScript Functions — Declare functions, pass arguments and return values.
  2. JavaScript Arrow Functions — The short => syntax, implicit returns and how arrows treat this.
  3. JavaScript Parameters — Default values, rest parameters and the spread operator.
  4. JavaScript Scope and Closures — Block scope, function scope and how closures remember variables.

Objects and Arrays

  1. JavaScript Objects — Create objects, read and update properties, and add methods.
  2. JavaScript Arrays — Create arrays, access items and add, remove and find elements.
  3. JavaScript Array Methods — Transform data with map, filter, reduce, some, every and flat.
  4. JavaScript Destructuring and Spread — Unpack arrays and objects into variables, and copy or merge with ...
  5. JavaScript Map and Set — Key-value maps with any key type, and sets of unique values.
  6. JavaScript JSON — Convert objects to JSON strings and parse JSON back into objects.

Classes and Modules

  1. JavaScript Classes — Define classes with constructors, methods, getters, static members and private fields.
  2. JavaScript Inheritance — Extend classes, call super and override methods.
  3. JavaScript Modules — Split code into files with export and import.

Asynchronous JavaScript

  1. JavaScript Callbacks and Timers — setTimeout, setInterval and the event loop.
  2. JavaScript Promises — Create and chain promises, handle errors and run tasks in parallel.
  3. JavaScript Async/Await — Write asynchronous code that reads like synchronous code.
  4. JavaScript Fetch API — Request data from APIs with fetch, check status codes and send JSON.

JavaScript Toolbox

  1. JavaScript Errors — Handle errors with try, catch and finally, and throw your own.
  2. JavaScript Dates — Create dates, read their parts, do date maths and format them.
  3. JavaScript Math — Rounding, powers, random numbers and other Math functions.
  4. JavaScript Regular Expressions — Match, test, extract and replace text with regular expressions.
  5. JavaScript Iterators and Generators — Make objects iterable and produce values lazily with generators.

JavaScript in the Browser

  1. JavaScript HTML DOM — The Document Object Model: how JavaScript sees and changes a web page.
  2. JavaScript DOM Manipulation — Create, insert and remove elements; change classes, styles and attributes.
  3. JavaScript Events — Respond to clicks, input and keyboard events with addEventListener.
  4. JavaScript Forms — Read form values, validate input and handle submit events.

Next Steps

  1. JavaScript Next Steps — Where to go after the basics: TypeScript, frameworks, Node.js and interview practice.