CodeBlanks Logo Icon CodeBlanks
Free 4 levels JavaScript

JavaScript

Learn ES2023+ JavaScript from variables to async programming with hands-on projects.

The JavaScript course covers all levels with variables, the DOM, async/await, modules, classes and metaprogramming. Each level ends with projects and challenges.

  • 430 lessons
  • 35 h 37 min
  • 10 projects

No account needed, you can start right away. To save your progress, create a free account

Levels

The JavaScript course goes from zero to expert in four levels. Start at any level you like.
Not sure of your level? Take the placement test
Beginner

Learn JavaScript fundamentals: variables, data types, loops, arrays, objects and functions.

  • Variables and data types
  • Operators
  • Conditionals
  • Numbers and Math
133 lessons · 10 h 45 min See lessons →
Intermediate

Build browser apps with arrow functions, closures, the DOM, events, async/await and fetch.

  • Arrow functions
  • Scope
  • Closures
  • DOM basics
134 lessons · 11 h 8 min See lessons →
Advanced

Learn advanced techniques with classes, prototypes, modules, generators, Proxy and metaprogramming.

  • ES modules
  • Classes
  • Prototypes
  • Destructuring
100 lessons · 8 h 25 min See lessons →
Expert

Master expert topics with design patterns, performance, web workers, security and canvas.

  • Design patterns
  • Performance
  • Observers and channels
  • Web Workers
63 lessons · 5 h 19 min See lessons →

Projects you will build

At every level you combine what you learned into a real page.

How does it work?

Short explanation

Each lesson explains one concept in a few short cards; no long videos or walls of text.

Try it right away

Multiple choice, fill-in-the-blank and matching exercises lock in what you just learned.

Write it yourself

You write real code in the in-browser editor; it is checked instantly and you see the result live.

Curriculum

74 groups · 430 lessons · 35 h 37 min

Learn JavaScript fundamentals: variables, data types, loops, arrays, objects and functions.

1
Variables and data types
6 lessons · 27 min
  1. 1 Declaring variables Learn to declare variables with let, const and var and the basic differences between them. 4 min
  2. 2 Difference between const and let Learn reassignment and immutability concepts. 5 min
  3. 3 First data types Learn the basic data types number, string and boolean and the primitive concept. 4 min
  4. 4 Difference between null and undefined Learn the difference between empty and undefined values and when to use each. 5 min
  5. 5 The typeof operator Learn how to check a variable's type with typeof and its pitfalls. 4 min
  6. 6 Summary - Variables and types Combine variable declaration and data types to write a small profile card. 5 min
2
Operators
6 lessons · 29 min
  1. 1 Arithmetic operators Learn basic arithmetic with +, -, *, /, % and ** operators. 4 min
  2. 2 Assignment operators Learn shortcut assignments with =, +=, -=, ++ and --. 5 min
  3. 3 Comparison operators Learn to compare values with ==, ===, !=, <, >, <= and >=. 5 min
  4. 4 Logical operators Learn boolean logic and short-circuit evaluation with &&, || and !. 5 min
  5. 5 Operator precedence Learn how operation order is determined and how to change precedence with parentheses. 5 min
  6. 6 Summary - Operators Combine arithmetic, comparison and logical operators to build a grade calculator. 5 min
3
Conditionals
6 lessons · 28 min
  1. 1 The if statement Learn how to check a condition with if and the code block. 4 min
  2. 2 else and else if Learn else and else if chains for alternative cases. 5 min
  3. 3 The switch statement Learn multi-way selection with switch, case, break and default. 5 min
  4. 4 The ternary operator Learn to write a conditional expression in one line with ? :. 4 min
  5. 5 Comparison pitfalls Learn the difference between === and == and type coercion pitfalls. 5 min
  6. 6 Summary - Conditionals Build a day-of-the-week app using if, switch and the ternary operator. 5 min
4
Numbers and Math
6 lessons · 28 min
  1. 1 Integers and decimals Learn integer and decimal numbers and that JavaScript has a single number type. 4 min
  2. 2 The Math object Learn rounding with Math.round, Math.floor and Math.ceil. 5 min
  3. 3 Math.random and Math.min/max Learn to generate random numbers and use Math.min/Math.max for bounds. 5 min
  4. 4 NaN and Infinity Learn what NaN and Infinity mean and how to check for them. 4 min
  5. 5 Converting to numbers Learn to convert strings to numbers with parseInt, parseFloat and Number(). 5 min
  6. 6 Summary - Numbers and Math Build a dice roll simulation using Math methods. 5 min
5
Project: CalculatorProject
5 lessons · 25 min
  1. 1 Project: Calculator Overview of the 5-lesson calculator project: you will operate on two numbers and an operator. 4 min
  2. 2 Number input and operator selection Take two numbers and an operator from the user to set up the operation. 5 min
  3. 3 Computing the operation Use switch to select the operator and compute the result. 5 min
  4. 4 Handling error cases Add guards for division by zero and invalid operator. 5 min
  5. 5 Project final - Calculator Combine all parts and finalize a working calculator. 6 min
6
String basics
6 lessons · 26 min
  1. 1 Creating strings Learn to create strings with single and double quotes and the difference between them. 4 min
  2. 2 length and character access Learn the length property and accessing characters with brackets. 4 min
  3. 3 String concatenation Learn to concatenate strings with + and the common mistakes around it. 4 min
  4. 4 Template literals Learn template literals with backticks and using expressions inside ${}. 5 min
  5. 5 Escape sequences Learn how to write special characters inside strings with \n, \t, \\ and \'. 4 min
  6. 6 Summary - String basics Build a greeting message combining strings, concatenation and template literals. 5 min
7
Loops
6 lessons · 28 min
  1. 1 The for loop Learn the for loop structure: counter, condition and increment steps. 5 min
  2. 2 The while loop Learn the while loop that runs as long as the condition is true. 4 min
  3. 3 The do...while loop Learn do...while that runs at least once and how it differs from while. 4 min
  4. 4 break and continue Learn to exit a loop with break and skip an iteration with continue. 5 min
  5. 5 Nested loops Learn to traverse structures like tables and matrices with nested loops. 5 min
  6. 6 Summary - Loops Print a multiplication table using for and while loops. 5 min
8
Array basics
6 lessons · 28 min
  1. 1 Creating and accessing arrays Learn to create array literals and access elements by index. 4 min
  2. 2 Adding elements to arrays Learn to add elements to the end and start of an array with push and unshift. 5 min
  3. 3 Removing elements from arrays Learn to remove elements from the end and start of an array with pop and shift. 5 min
  4. 4 length and index relationship Learn the length property and how to access the last element. 4 min
  5. 5 Multidimensional arrays Learn to create matrix-like structures with nested arrays. 5 min
  6. 6 Summary - Array basics Build a queue app using push, pop, shift and unshift. 5 min
9
Functions
6 lessons · 28 min
  1. 1 Defining and calling functions Learn to define and call functions with the function keyword. 4 min
  2. 2 The return statement Learn to return a value from a function and early return. 4 min
  3. 3 Parameters and arguments Learn the difference between parameters and arguments. 5 min
  4. 4 Function expressions Learn the anonymous function expression assigned to a variable. 5 min
  5. 5 Scope basics Learn why variables declared inside a function are not accessible from outside. 5 min
  6. 6 Summary - Functions Write a VAT calculation function and call it with different amounts. 5 min
10
Project: Shopping cartProject
5 lessons · 25 min
  1. 1 Project: Shopping cart Overview of the 5-lesson shopping cart project: add products and compute the total. 4 min
  2. 2 Defining the product list Set up the cart foundation with arrays of product names and prices. 5 min
  3. 3 Adding products to the cart Add products to the cart with push and list them with a loop. 5 min
  4. 4 Computing the total Sum each product's price with a loop to find the cart total. 5 min
  5. 5 Project final - Shopping cart Finalize the cart app showing the added products and the total amount. 6 min
11
Array iteration
6 lessons · 28 min
  1. 1 Looping with forEach Learn to traverse an array with forEach and the callback idea. 5 min
  2. 2 The for...of loop Learn to iterate over array values with for...of. 4 min
  3. 3 Searching with indexOf Learn to find an element's position with indexOf. 5 min
  4. 4 Checking with includes Learn to check whether an element is in the array with includes. 4 min
  5. 5 findIndex and some Learn findIndex for the first matching index and some for any match. 5 min
  6. 6 Summary - Array iteration Print a task list using forEach and for...of. 5 min
12
Array transformations
6 lessons · 31 min
  1. 1 Transforming with map Learn to transform each element and create a new array with map. 5 min
  2. 2 Filtering with filter Learn to select elements matching a condition with filter. 5 min
  3. 3 Finding with find Learn to return the first matching element with find. 5 min
  4. 4 some and every Learn some for any match and every for all matching. 5 min
  5. 5 Reducing with reduce Learn to reduce an array to a single value and the accumulator idea. 6 min
  6. 6 Summary - Array transformations Compute a class grade average with map, filter and reduce. 5 min
13
Objects
6 lessons · 30 min
  1. 1 Creating objects Learn to create objects with key-value pairs using object literals. 5 min
  2. 2 Property access Learn dot and bracket notation for property access and when to use each. 5 min
  3. 3 Adding and changing properties Learn to add new properties and change existing ones. 5 min
  4. 4 Defining methods Learn to define methods inside an object and the shorthand syntax. 5 min
  5. 5 The this keyword Learn what this refers to inside a method and how it works. 5 min
  6. 6 Summary - Objects Build a bank account app using objects and methods. 5 min
14
Project: Quiz appProject
5 lessons · 25 min
  1. 1 Project: Quiz app Overview of the 5-lesson quiz project: define questions and compute the score. 4 min
  2. 2 Defining question objects Build an array of objects holding question, options and correct answer. 5 min
  3. 3 Showing questions and getting answers Show questions one by one with for...of and collect answers. 5 min
  4. 4 Computing the score Check the answer with if and increment the score counter. 5 min
  5. 5 Project final - Quiz Finalize the quiz app and display the total score. 6 min
15
Parameters
6 lessons · 29 min
  1. 1 Default parameters Learn what happens with missing arguments by setting default parameter values. 5 min
  2. 2 The rest parameter Learn to collect unlimited arguments as an array with ...args. 5 min
  3. 3 The arguments object Learn the legacy arguments object you often see in old code and why rest is preferred. 4 min
  4. 4 Return value types Learn to return numbers, arrays and objects and how to return multiple values. 5 min
  5. 5 Helper functions Learn to break a big problem into small helper functions. 5 min
  6. 6 Summary - Parameters Write a flexible order summary function using default and rest parameters. 5 min
16
Boolean logic
6 lessons · 29 min
  1. 1 Boolean values Learn true and false values and expressions that return booleans. 4 min
  2. 2 Short-circuit evaluation Learn how && and || short-circuit values and the patterns based on it. 5 min
  3. 3 Nullish coalescing Learn to give a default for null and undefined with the ?? operator. 5 min
  4. 4 Optional chaining Learn to safely access null and undefined values with ?. 5 min
  5. 5 Logical assignment Learn shortcut logical assignments with &&=, ||= and ??=. 5 min
  6. 6 Summary - Boolean logic Write a safe user profile fetcher using short-circuit, nullish and optional chaining. 5 min
17
Type conversion
6 lessons · 30 min
  1. 1 Explicit type conversion Learn explicit type conversion with String(), Number() and Boolean(). 5 min
  2. 2 Implicit type coercion Learn how implicit type coercion works with +, == and in if conditions. 5 min
  3. 3 Difference between == and === Learn equality operators that do and do not perform type conversion. 5 min
  4. 4 Truthy and falsy values Learn which values are considered false and which are true in a boolean context. 5 min
  5. 5 Common conversion pitfalls Learn common number-conversion mistakes and how to avoid them. 5 min
  6. 6 Summary - Type conversion Write a function that safely converts user input to numbers using type conversion. 5 min
18
Project: To-do listProject
5 lessons · 25 min
  1. 1 Project: To-do list Overview of the 5-lesson to-do project: manage tasks as objects. 4 min
  2. 2 Designing the task object Design a task object holding id, title and completion state. 5 min
  3. 3 Adding and listing tasks Add tasks with push and display them with for...of. 5 min
  4. 4 Completing and deleting tasks Find a task with findIndex to complete it and remove it with filter. 5 min
  5. 5 Project final - To-do list Finalize the to-do app and make all commands work. 6 min
19
Advanced string methods
6 lessons · 29 min
  1. 1 slice and substring Learn to slice parts of a string with slice and substring. 5 min
  2. 2 replace and replaceAll Learn to change the first match with replace and all matches with replaceAll. 5 min
  3. 3 split and join Learn to convert a string to an array with split and back with join. 5 min
  4. 4 trim, padStart, padEnd Learn to trim whitespace and pad a string to a length with padStart/padEnd. 5 min
  5. 5 Case and includes Learn string operations with toUpperCase, toLowerCase and includes. 4 min
  6. 6 Summary - Advanced string methods Build a function that reverses a sentence word by word using split, map and join. 5 min
20
Console methods
6 lessons · 28 min
  1. 1 console.log basics Learn to log output and pass multiple arguments with console.log. 4 min
  2. 2 console.warn and console.error Learn warn and error methods for warning and error messages. 4 min
  3. 3 Tables with console.table Learn console.table to display arrays and objects as tables. 5 min
  4. 4 console.group and groupEnd Learn to group console output and create nested groups. 5 min
  5. 5 Timing with console.time Learn to measure an operation's duration with console.time and timeEnd. 5 min
  6. 6 Summary - Console methods Print a dataset neatly using console.group and console.table. 5 min
21
Errors
6 lessons · 30 min
  1. 1 try...catch basics Learn to catch errors with try and catch and prevent the app from crashing. 5 min
  2. 2 Throwing errors with throw Learn to throw your own errors and when to use it. 5 min
  3. 3 The Error object Learn the Error object's message and name properties and how to create one. 5 min
  4. 4 The finally block Learn finally for cleanup code that runs whether or not an error occurred. 5 min
  5. 5 Common error types Recognize common error types like TypeError, RangeError and ReferenceError. 5 min
  6. 6 Summary - Errors Safely handle a division by zero using try/catch/finally and throw. 5 min
22
Debugging
6 lessons · 29 min
  1. 1 What is debugging? Learn the debugging process and effective approaches. 4 min
  2. 2 Call traces with console.trace Learn to see a function's call stack with console.trace. 5 min
  3. 3 The debugger statement Learn to pause code and step through it in DevTools with the debugger statement. 5 min
  4. 4 Checking with console.assert Learn to log an error when a condition fails with console.assert. 5 min
  5. 5 Common bug patterns Recognize common bugs like off-by-one, undefined access and wrong comparison. 5 min
  6. 6 Summary - Debugging Test a calculation function using console.assert and console.trace. 5 min
23
Beginner finalFinal
5 lessons · 30 min
  1. 1 Challenge - Calculator Combine arithmetic operators, conditionals and functions to write a calculator function. 6 min
  2. 2 Challenge - Array operations Compute total revenue from a store's sales list with arrays, loops and reduce. 6 min
  3. 3 Challenge - Object management Build a library book app with objects, properties and methods. 6 min
  4. 4 Challenge - String operations Build a text formatting tool with string methods and template literals. 6 min
  5. 5 Challenge - Error handling Write a function that validates age using try/catch and throw. 6 min

Build browser apps with arrow functions, closures, the DOM, events, async/await and fetch.

1
Arrow functions
6 lessons · 30 min
  1. 1 Arrow function syntax Learn the => shorthand for functions and how it differs from a classic function. 5 min
  2. 2 Single-line and block body Learn the difference between single-line implicit return and block body arrows. 5 min
  3. 3 Parameters with arrows Learn single, no and multi-parameter arrow syntax. 5 min
  4. 4 The this context Learn that arrow functions bind this lexically and what that means. 5 min
  5. 5 Arrow vs function Learn when arrows cannot be used (constructor, arguments). 5 min
  6. 6 Summary - Arrow functions Build an array filtering and sorting tool using arrow functions. 5 min
2
Scope
6 lessons · 28 min
  1. 1 Global scope Learn that variables declared in global scope are accessible everywhere. 4 min
  2. 2 Function scope Learn that variables declared inside a function are not accessible from outside. 4 min
  3. 3 Block scope Learn block-scoped variables with let and const and how they differ from var. 5 min
  4. 4 Variable shadowing Learn to shadow an outer variable by declaring one with the same name in an inner scope. 5 min
  5. 5 Hoisting Learn how var and function declarations are hoisted while let/const are not. 5 min
  6. 6 Summary - Scope Build a counter module using global, function and block scope. 5 min
3
Closures
6 lessons · 30 min
  1. 1 What is a closure? Learn how a function keeps accessing the variables of its defining scope. 5 min
  2. 2 Factory functions Learn how a returned function captures private state. 5 min
  3. 3 Immediately Invoked Function Expressions Learn the IIFE pattern that runs immediately and when to use it. 5 min
  4. 4 The module pattern Learn the module pattern that protects private variables from outside. 5 min
  5. 5 Closure pitfalls Learn a common mistake creating closures in loops and how to fix it. 5 min
  6. 6 Summary - Closures Build a bank account with private variables using closures and IIFE. 5 min
4
DOM basics
6 lessons · 29 min
  1. 1 What is the DOM? Learn how the browser turns HTML into a tree and the document object. 5 min
  2. 2 getElementById Learn to select an element by id and write safely against a null return. 4 min
  3. 3 querySelector Learn to select the first matching element with a CSS selector. 5 min
  4. 4 querySelectorAll Learn to select multiple elements and get them as a NodeList. 5 min
  5. 5 textContent and innerText Learn to read and change an element's text. 5 min
  6. 6 Summary - DOM basics Update a profile card's information using querySelector and textContent. 5 min
5
DOM manipulation
6 lessons · 30 min
  1. 1 Creating elements with createElement Learn to create a new HTML element and add it to the page. 5 min
  2. 2 appendChild and removeChild Learn to append and remove an element from another. 5 min
  3. 3 The classList API Learn to add and remove classes with add, remove, toggle and contains. 5 min
  4. 4 setAttribute and removeAttribute Learn to add, change and remove attributes. 5 min
  5. 5 innerHTML and insertAdjacentHTML Learn to change content with innerHTML and add at a position with insertAdjacentHTML. 5 min
  6. 6 Summary - DOM manipulation Write a function that adds a new comment to a comment list using createElement and appendChild. 5 min
6
Events
6 lessons · 29 min
  1. 1 addEventListener basics Learn to add an event listener with addEventListener and how it differs from onclick. 5 min
  2. 2 Click events Learn to react to user clicks with the click event. 4 min
  3. 3 Mouse events Learn to track mouse movement with mouseover, mouseout and mousemove. 5 min
  4. 4 Keyboard events Learn to capture pressed keys with keydown and keyup. 5 min
  5. 5 The event object Learn to use the event object's target and type properties. 5 min
  6. 6 Summary - Events Build a shortcut entry app using click and keydown events. 5 min
7
Event handling
6 lessons · 30 min
  1. 1 Event bubbling Learn how an event bubbles up the DOM and what that means. 5 min
  2. 2 stopPropagation Learn to stop an event from bubbling up and when to use it. 5 min
  3. 3 Event delegation Learn to manage many child elements with a single listener on a parent. 5 min
  4. 4 preventDefault Learn to prevent an event's default behavior (e.g. form submit). 5 min
  5. 5 once and passive options Learn to run a listener once and gain performance with passive. 5 min
  6. 6 Summary - Event handling Manage many buttons with a single listener using event delegation and preventDefault. 5 min
8
Local storage
6 lessons · 29 min
  1. 1 localStorage basics Learn to store persistent key-value pairs in the browser with localStorage. 5 min
  2. 2 sessionStorage Learn to store tab-scoped temporary data with sessionStorage. 5 min
  3. 3 Storing data with JSON Learn to store objects and arrays in localStorage as JSON. 5 min
  4. 4 Clearing storage Learn to clear storage with removeItem and clear. 4 min
  5. 5 Storage events Learn to be notified when storage changes in another tab of the same origin. 5 min
  6. 6 Summary - Local storage Build an app that saves and restores a dark-mode preference using localStorage and JSON. 5 min
9
Project: To-do appProject
5 lessons · 25 min
  1. 1 Project: To-do app Overview of the 5-lesson DOM-based to-do project: UI, events and localStorage. 4 min
  2. 2 UI skeleton Build the task list UI with createElement and appendChild. 5 min
  3. 3 Adding a task Take the input value with addEventListener and click event and add a task. 5 min
  4. 4 Completing and deleting a task - DOM Use event delegation with a single listener for completion and deletion. 5 min
  5. 5 Project final - To-do DOM Finalize the to-do app and make the UI and interactions work. 6 min
10
Forms
6 lessons · 29 min
  1. 1 Accessing form elements Learn to access form and input elements via form.elements and querySelector. 5 min
  2. 2 Reading input values Learn to read input values with the value property and check for empty inputs. 4 min
  3. 3 The form submit event Learn to capture the submit event and prevent page reload with preventDefault. 5 min
  4. 4 Basic validation Learn basic validation with required fields and length checks. 5 min
  5. 5 Checkbox and radio Learn to read checkbox and radio states with the checked property. 5 min
  6. 6 Summary - Forms Build an app that collects and displays data from a registration form using the submit event and validation. 5 min
11
Timers
6 lessons · 30 min
  1. 1 setTimeout Learn to run code once after a delay with setTimeout. 5 min
  2. 2 setInterval Learn to run code repeatedly at an interval with setInterval. 5 min
  3. 3 Stopping with clearInterval Learn to stop a timer with clearInterval and clearTimeout. 5 min
  4. 4 requestAnimationFrame Learn the requestAnimationFrame loop for smooth animations. 5 min
  5. 5 Timer cleanup Learn to prevent memory leaks by cleaning up timers when an element is removed. 5 min
  6. 6 Summary - Timers Build a countdown timer with setInterval and a simple animation with requestAnimationFrame. 5 min
12
Callbacks
6 lessons · 30 min
  1. 1 Callback functions Learn the idea of a callback passed as a function argument. 5 min
  2. 2 Asynchronous callbacks Learn how a callback is later invoked by the event loop. 5 min
  3. 3 Error-first callbacks Learn the Node.js error-first callback convention. 5 min
  4. 4 Callback hell Learn the pyramid of nested callbacks and why it is problematic. 5 min
  5. 5 Managing callbacks Learn to make nested callbacks manageable by splitting them into named functions. 5 min
  6. 6 Summary - Callbacks Build a file-read simulation using an error-first callback. 5 min
13
Promises
6 lessons · 30 min
  1. 1 What is a promise? Learn the promise states: pending, fulfilled and rejected. 5 min
  2. 2 Catching success with then Learn to capture the successful result with then. 5 min
  3. 3 Catching errors with catch Learn to catch a promise rejection and use the error message. 5 min
  4. 4 Cleanup with finally Learn finally for cleanup that runs whether the promise succeeded or failed. 5 min
  5. 5 Promise.all and Promise.race Learn Promise.all for parallel promises and Promise.race. 5 min
  6. 6 Summary - Promises Write a user-fetch-and-display flow using a promise chain. 5 min
14
async/await
6 lessons · 30 min
  1. 1 async functions Learn how the async keyword makes a function return a promise. 5 min
  2. 2 The await operator Learn to wait for a promise's result with await. 5 min
  3. 3 Async error handling Learn to catch errors in async functions with try/catch. 5 min
  4. 4 Parallel await Learn to run multiple operations in parallel with Promise.all and await. 5 min
  5. 5 await expressions Learn to iterate async iterables with for await...of. 5 min
  6. 6 Summary - async/await Build a flow that fetches data from two APIs in sequence and combines them using async/await. 5 min
15
Fetch API
6 lessons · 30 min
  1. 1 fetch basics Learn to make a GET request with fetch and the Response object. 5 min
  2. 2 Reading JSON Learn to read the response body with response.json(). 5 min
  3. 3 HTTP headers Learn to build headers and send Accept, Content-Type in requests. 5 min
  4. 4 POST requests Learn to send a POST request with method, body and headers. 5 min
  5. 5 HTTP error handling Learn to catch HTTP errors with response.ok and status. 5 min
  6. 6 Summary - Fetch API Build a client function that makes GET and POST requests with fetch and handles errors. 5 min
16
Project: Weather panelProject
5 lessons · 25 min
  1. 1 Project: Weather panel Overview of the 5-lesson weather project: city input, fetch and DOM update. 4 min
  2. 2 UI and city input Set up city input with input and button and bind the click event. 5 min
  3. 3 Fetching data with fetch Fetch weather data from an API using fetch and async/await. 5 min
  4. 4 Rendering data to the DOM Render fetched data to the UI with template literals and textContent. 5 min
  5. 5 Project final - Weather panel Finalize the weather panel and make city input show the temperature. 6 min
17
Project: Gallery appProject
5 lessons · 25 min
  1. 1 Project: Gallery app Overview of the 5-lesson gallery project: fetch images, grid and large view. 4 min
  2. 2 Fetching the image list Fetch an image list from an API with async/await and parse it as JSON. 5 min
  3. 3 Building the gallery grid Create a card for each image with forEach and createElement and add it to the grid. 5 min
  4. 4 Large image view Show the large image when a card is clicked using click event and event delegation. 5 min
  5. 5 Project final - Gallery Finalize the gallery app and run fetch, grid and large-view flow. 6 min
18
Error handling
6 lessons · 30 min
  1. 1 Custom error classes Learn to create your own error class by extending Error. 5 min
  2. 2 Error propagation Learn to propagate an error up the call chain by rethrowing it. 5 min
  3. 3 Multiple catch patterns Learn to handle different error types inside a single catch block. 5 min
  4. 4 Async error strategies Learn different error-catching strategies for promises and async functions. 5 min
  5. 5 Global error handling Learn to collect uncaught errors with window.onerror and unhandledrejection. 5 min
  6. 6 Summary - Error handling Build a user sign-up flow with a custom error class and async error handling. 5 min
19
JSON
6 lessons · 29 min
  1. 1 The JSON format Learn JSON syntax and which data types it supports. 4 min
  2. 2 JSON.parse Learn to convert a JSON string into an object with JSON.parse. 5 min
  3. 3 JSON.stringify Learn to convert an object into a JSON string with JSON.stringify. 5 min
  4. 4 structuredClone Learn to deep copy an object with structuredClone. 5 min
  5. 5 JSON limitations Learn JSON limits, such as how it handles undefined, Date and functions. 5 min
  6. 6 Summary - JSON Write a function that saves and reloads a settings object using JSON.stringify and JSON.parse. 5 min
20
Date and time
6 lessons · 30 min
  1. 1 Creating Date objects Learn to create Date objects and basic methods like now and parse. 5 min
  2. 2 Reading date components Learn to read date components with getFullYear, getMonth and getDate. 5 min
  3. 3 Formatting dates Learn to format dates with toLocaleString and ISO format. 5 min
  4. 4 Intl.DateTimeFormat Learn locale-aware date formatting with Intl.DateTimeFormat. 5 min
  5. 5 Date arithmetic Learn to compute the difference between two dates and compare dates using timestamps. 5 min
  6. 6 Summary - Date and time Build a birthday countdown app using Date and Intl.DateTimeFormat. 5 min
21
RegExp basics
6 lessons · 30 min
  1. 1 RegExp syntax Learn to create patterns with the RegExp literal and object. 5 min
  2. 2 Character classes Learn to narrow patterns with character classes like \d, \w and \s. 5 min
  3. 3 Quantifiers Learn to specify repetition with *, +, ? and {}. 5 min
  4. 4 test and match Learn to check a match with test and extract matches with match. 5 min
  5. 5 replace and split with regex Learn to do string operations with regex using replace and split. 5 min
  6. 6 Summary - RegExp basics Build a validation function that extracts email-like addresses from text using regex. 5 min
22
Modules
6 lessons · 30 min
  1. 1 What is a module? Learn what the ES module system provides and file scope. 5 min
  2. 2 Named export Learn to export multiple values with export. 5 min
  3. 3 Default export Learn to export a module's default value. 5 min
  4. 4 The import statement Learn to import values from a module with named and default imports. 5 min
  5. 5 Module vs script Learn the differences between module and script (strict mode etc.) with type='module'. 5 min
  6. 6 Summary - Modules Build a simple two-file calculator module using named and default export/import. 5 min
23
Intermediate finalFinal
5 lessons · 30 min
  1. 1 Challenge - DOM app Build a note cards board with querySelector, createElement and events. 6 min
  2. 2 Challenge - Async flow Build a fetch flow with error handling using async/await and fetch. 6 min
  3. 3 Challenge - Form and storage Build a contact form with form validation, localStorage and JSON. 6 min
  4. 4 Challenge - Timers and animation Build a smooth progress bar with setInterval and requestAnimationFrame. 6 min
  5. 5 Challenge - Modular structure Build a counter module with private state using ES modules and closures. 6 min

Learn advanced techniques with classes, prototypes, modules, generators, Proxy and metaprogramming.

1
ES modules
6 lessons · 30 min
  1. 1 Dynamic import Learn to load a module at runtime with the import() expression. 5 min
  2. 2 Import aliases Learn to rename imports with as. 5 min
  3. 3 Re-export Learn to forward a module's values to another with export ... from. 5 min
  4. 4 Import meta Learn to get module metadata with import.meta. 5 min
  5. 5 Import maps Learn to resolve bare module names with import maps. 5 min
  6. 6 Summary - ES modules Build a lazily-loaded module structure using dynamic import and re-export. 5 min
2
Classes
6 lessons · 30 min
  1. 1 Defining a class Learn to define a class with the class keyword. 5 min
  2. 2 constructor and instance Learn to create a new instance with constructor and the new operator. 5 min
  3. 3 Methods and this Learn to define methods inside a class and the this context. 5 min
  4. 4 extends and super Learn to subclass with extends and call the parent with super. 5 min
  5. 5 static members Learn class-level methods and properties with static. 5 min
  6. 6 Summary - Classes Build a geometric shape class hierarchy with extends, super and static. 5 min
3
Prototypes
6 lessons · 30 min
  1. 1 What is a prototype? Learn the prototype object every object links to and the shared behavior. 5 min
  2. 2 __proto__ and Object.getPrototypeOf Learn an object's prototype with __proto__ and Object.getPrototypeOf. 5 min
  3. 3 Object.create Learn to create objects using an existing prototype with Object.create. 5 min
  4. 4 The prototype chain Learn how property lookup walks the prototype chain. 5 min
  5. 5 Prototype pollution Learn the prototype pollution risk and how to guard with hasOwnProperty. 5 min
  6. 6 Summary - Prototypes Build an animal inheritance structure using Object.create and the prototype chain. 5 min
4
Project: Utility libraryProject
5 lessons · 25 min
  1. 1 Project: Utility library Overview of the 5-lesson utility library project: reusable structures with class + module. 4 min
  2. 2 Class skeleton Define a collection class and set up internal state with the constructor. 5 min
  3. 3 Adding methods Add add, remove and find methods to the class. 5 min
  4. 4 Exporting as a module Export the class with both named and default exports. 5 min
  5. 5 Project final - Library Finalize the library and import the module from another file to use it. 6 min
5
Destructuring
6 lessons · 30 min
  1. 1 Object destructuring Learn to extract object properties into variables with a shorthand. 5 min
  2. 2 Array destructuring Learn to extract array elements into variables in order. 5 min
  3. 3 Default values Learn to give default values for missing properties in destructuring. 5 min
  4. 4 Renaming Learn to assign a property to a variable with a different name in destructuring. 5 min
  5. 5 Nested destructuring Learn to extract deeply nested properties. 5 min
  6. 6 Summary - Destructuring Write a function that parses an API response using destructuring. 5 min
6
Spread and rest
6 lessons · 30 min
  1. 1 Spread operator (arrays) Learn to spread an array's elements with .... 5 min
  2. 2 Spread (objects) Learn to spread an object's properties into another with .... 5 min
  3. 3 Flexible parameters with rest Learn to combine the rest parameter with destructuring and how it differs from the arguments object. 5 min
  4. 4 Copying with spread Learn to make shallow copies of arrays and objects with spread. 5 min
  5. 5 Spread in function calls Learn to spread an array's elements as function arguments. 5 min
  6. 6 Summary - Spread and rest Build a function that merges a config object with defaults using spread and rest. 5 min
7
Map and Set
6 lessons · 30 min
  1. 1 The Map data structure Learn the ordered key-value Map that accepts any key type. 5 min
  2. 2 The Set data structure Learn the Set collection that holds unique values. 5 min
  3. 3 Map iteration Learn to iterate a Map with for...of, entries and forEach. 5 min
  4. 4 WeakMap and WeakSet Learn how WeakMap and WeakSet work with the garbage collector. 5 min
  5. 5 Map vs Object Learn the differences between Map and Object and when to use each. 5 min
  6. 6 Summary - Map and Set Build a word counter app using Map and Set. 5 min
8
Iterators
6 lessons · 30 min
  1. 1 The iterator protocol Learn the next() method and the done/value structure. 5 min
  2. 2 The iterable protocol Learn how an object becomes iterable with Symbol.iterator. 5 min
  3. 3 for...of in depth Learn how for...of uses the iterator protocol under the hood. 5 min
  4. 4 Creating a custom iterator Learn to create a custom iterator by adding Symbol.iterator to an object. 5 min
  5. 5 Common iterables Learn common iterables like arrays, strings, NodeList and Map. 5 min
  6. 6 Summary - Iterators Build a number-range iterable object using Symbol.iterator. 5 min
9
Generators
6 lessons · 30 min
  1. 1 Generator functions Learn to define a generator with function* and the generator object. 5 min
  2. 2 The yield keyword Learn to pause a generator and return a value with yield. 5 min
  3. 3 Generator iteration Learn to step through a generator with next(). 5 min
  4. 4 Delegation with yield* Learn to delegate to another generator or iterable with yield*. 5 min
  5. 5 Async generators Learn async generators with async function* and iterate them with for await...of. 5 min
  6. 6 Summary - Generators Build a function that generates an infinite number sequence using a generator. 5 min
10
Functional programming
6 lessons · 30 min
  1. 1 Pure functions Learn pure functions with no side effects that return the same output for the same input. 5 min
  2. 2 Immutability Learn to update data by copying instead of mutating it. 5 min
  3. 3 Composition Learn to combine small functions into bigger ones. 5 min
  4. 4 Currying Learn to turn a function into a chain that takes arguments one at a time. 5 min
  5. 5 Higher-order functions Learn higher-order functions that take or return functions. 5 min
  6. 6 Summary - Functional programming Build a price-calculation chain using compose and curry. 5 min
11
Proxy and Reflect
6 lessons · 30 min
  1. 1 What is a Proxy? Learn to intercept operations on an object with a Proxy. 5 min
  2. 2 get and set traps Learn to intercept property read and write with get and set traps. 5 min
  3. 3 has and deleteProperty traps Learn to intercept the in operator and delete with has and deleteProperty traps. 5 min
  4. 4 The Reflect API Learn the Reflect object and how to apply default behavior inside a trap. 5 min
  5. 5 Proxy use cases Learn real proxy uses like validation, logging and tracing. 5 min
  6. 6 Summary - Proxy and Reflect Build a wrapper that logs property access on an object using Proxy and Reflect. 5 min
12
Symbol
6 lessons · 30 min
  1. 1 What is a Symbol? Learn to create a unique, immutable primitive value with Symbol. 5 min
  2. 2 Symbol.for and Symbol.keyFor Learn to get a symbol from the global registry and find its key. 5 min
  3. 3 Well-known symbols Learn built-in symbols like Symbol.iterator and Symbol.toPrimitive. 5 min
  4. 4 Hidden properties with Symbol Learn that Symbol properties are hidden and do not appear in for...in. 5 min
  5. 5 Symbol use cases Learn real symbol uses like the enum pattern and extension-safe properties. 5 min
  6. 6 Summary - Symbol Add a private property to an object that is invisible to for...in using Symbol. 5 min
13
Async patterns
6 lessons · 30 min
  1. 1 Promise.allSettled Wait for all promises to settle and learn each one's outcome. 5 min
  2. 2 Promise.any Learn to capture the first fulfilled promise with Promise.any. 5 min
  3. 3 Promise.race in depth Learn the timeout pattern and using the first result with Promise.race. 5 min
  4. 4 Asynchronous iteration Learn to traverse async iterables with for await...of. 5 min
  5. 5 Concurrency control Learn to limit how many operations run at once and process in batches. 5 min
  6. 6 Summary - Async patterns Safely manage multiple API calls with Promise.allSettled and for await...of. 5 min
14
History API
6 lessons · 30 min
  1. 1 What is the History API? Learn the basics of working with the browser session history and the history object. 5 min
  2. 2 pushState Learn to change the URL and add a new history entry without reload with pushState. 5 min
  3. 3 replaceState Learn to replace the current history entry with replaceState. 5 min
  4. 4 The popstate event Learn to catch the popstate event fired on back/forward navigation. 5 min
  5. 5 SPA routing basics Learn simple client-side routing that works without page reloads with the History API. 5 min
  6. 6 Summary - History API Build a two-page SPA routing app with pushState and popstate. 5 min
15
IndexedDB
6 lessons · 30 min
  1. 1 What is IndexedDB? Learn what IndexedDB provides and how it differs from localStorage. 5 min
  2. 2 Opening a database Learn to open a database with indexedDB.open and handle version changes. 5 min
  3. 3 Creating an object store Learn to create an object store in a database and the keyPath. 5 min
  4. 4 Adding and reading data Learn to add and get data through a transaction. 5 min
  5. 5 Indexes and queries Learn to add an index to an object store and run range queries. 5 min
  6. 6 Summary - IndexedDB Build an app that persistently stores notes data using IndexedDB. 5 min
16
Advanced DOM
6 lessons · 30 min
  1. 1 MutationObserver Learn to use MutationObserver to watch DOM changes. 5 min
  2. 2 IntersectionObserver Learn to lazy-load by observing when an element enters the viewport with IntersectionObserver. 5 min
  3. 3 ResizeObserver Learn to observe an element's size changes with ResizeObserver. 5 min
  4. 4 Custom elements Learn to create your own HTML element with customElements.define. 5 min
  5. 5 Shadow DOM basics Encapsulate styles and DOM by attaching a shadow root to an element. 5 min
  6. 6 Summary - Advanced DOM Build a lazy-loaded image component using IntersectionObserver and custom elements. 5 min
17
Advanced finalFinal
5 lessons · 30 min
  1. 1 Challenge - Class hierarchy Build an employee-manager hierarchy with classes, extends, super and static. 6 min
  2. 2 Challenge - Functional chain Build a text-processing chain with pure functions, composition and currying. 6 min
  3. 3 Challenge - Custom iterable Build a custom iterable collection with Symbol.iterator and a generator. 6 min
  4. 4 Challenge - IndexedDB app Build a bookmarks app's add-and-query flow with IndexedDB. 6 min
  5. 5 Challenge - Custom element Build a component structure with custom elements and shadow DOM. 6 min

Master expert topics with design patterns, performance, web workers, security and canvas.

1
Design patterns
6 lessons · 30 min
  1. 1 What is a design pattern? Learn what design patterns provide and common catalogs. 5 min
  2. 2 The Singleton pattern Learn the Singleton pattern that ensures a single instance of a class. 5 min
  3. 3 The Factory pattern Learn the pattern that moves object creation into a factory function. 5 min
  4. 4 The Observer pattern Learn the pattern where a subject notifies multiple observers. 5 min
  5. 5 Module pattern - modern comparison Compare the classic module pattern with ES modules and learn when to use each. 5 min
  6. 6 Summary - Design patterns Build an event-emitter library using the Observer and Factory patterns. 5 min
2
Performance
6 lessons · 30 min
  1. 1 Performance measurement Learn to measure an operation's duration with performance.now and profiling. 5 min
  2. 2 Memoization Learn to memoize an expensive function by caching its results. 5 min
  3. 3 Debounce Learn to delay a frequently-fired event with debounce. 5 min
  4. 4 Throttle Use throttle to ensure a function runs at most once per interval. 5 min
  5. 5 Memory leaks Learn common memory-leak causes and how to prevent them. 5 min
  6. 6 Summary - Performance Build a search-input app using memoization, debounce and throttle. 5 min
3
Observers and channels
6 lessons · 30 min
  1. 1 PerformanceObserver Learn to observe performance entries with PerformanceObserver. 5 min
  2. 2 ResizeObserver in depth Learn element size changes and content box size with ResizeObserver. 5 min
  3. 3 The Reporting API Learn to collect browser reports with the Reporting API. 5 min
  4. 4 Broadcast channel Learn cross-tab messaging between same-origin tabs with BroadcastChannel. 5 min
  5. 5 MessageChannel Learn two-way communication between two ports with MessageChannel. 5 min
  6. 6 Summary - Observers and channels Build a multi-tab metrics collection demo with PerformanceObserver and BroadcastChannel. 5 min
4
Web Workers
6 lessons · 30 min
  1. 1 What are Web Workers? Learn to offload heavy work to a background thread with Web Workers. 5 min
  2. 2 Creating a worker Learn to create a worker with the Worker constructor and bind its script. 5 min
  3. 3 postMessage Learn to send messages between the main thread and the worker. 5 min
  4. 4 Receiving data from a worker Learn to catch messages from the worker with onmessage. 5 min
  5. 5 Transferable objects Learn to transfer large data to a worker without copying memory. 5 min
  6. 6 Summary - Web Workers Build an app that sorts a large array in the background with a worker. 5 min
5
Security
6 lessons · 30 min
  1. 1 What is XSS? Learn what cross-site scripting (XSS) attacks are and their types. 5 min
  2. 2 innerHTML risks Learn how innerHTML creates an XSS risk and safer alternatives. 5 min
  3. 3 CSP basics Learn to limit which sources can run scripts with Content Security Policy. 5 min
  4. 4 Safe evaluation Learn the risks of eval and the Function constructor and safer alternatives. 5 min
  5. 5 Input sanitization Learn to prevent XSS by sanitizing input and encoding output. 5 min
  6. 6 Summary - Security Build a safe comment render function with textContent, an escape function and CSP headers. 5 min
6
Project: Secure comments appProject
5 lessons · 25 min
  1. 1 Project: Secure comments app Overview of the 5-lesson secure comments project: XSS-safe rendering and CSP. 4 min
  2. 2 Comment form skeleton Build the comment form with addEventListener and DOM. 5 min
  3. 3 XSS-safe rendering Show user input safely with textContent and an escape function. 5 min
  4. 4 CSP and nonce Limit inline scripts with CSP headers and a script nonce. 5 min
  5. 5 Project final - Secure comments Finalize the comments app with XSS-safe rendering and CSP enforcement. 6 min
7
Metaprogramming
6 lessons · 30 min
  1. 1 What is metaprogramming? Learn how code manages other code and the reflection concept. 5 min
  2. 2 Validation with Proxy Learn to write a wrapper that validates property assignments with Proxy. 5 min
  3. 3 Default behavior with Reflect Learn to apply default behavior inside a trap and manage side effects with Reflect. 5 min
  4. 4 Custom behavior with Symbol.iterator Learn to add custom iteration behavior to an object with Symbol.iterator. 5 min
  5. 5 The decorator pattern Learn to add behavior by wrapping a function with another function. 5 min
  6. 6 Summary - Metaprogramming Build a logging wrapper with Proxy, Reflect and the decorator pattern. 5 min
8
Canvas
6 lessons · 29 min
  1. 1 The canvas element Learn the canvas element and how to get its 2D drawing context. 5 min
  2. 2 Drawing coordinates Learn the canvas coordinate system and origin point. 4 min
  3. 3 Drawing rectangles Learn to draw rectangles with fillRect, strokeRect and clearRect. 5 min
  4. 4 Paths and lines Learn to draw paths and lines with beginPath, moveTo, lineTo and stroke. 5 min
  5. 5 Drawing animation Learn to set up a canvas animation loop with requestAnimationFrame. 5 min
  6. 6 Summary - Canvas Build a bouncing ball animation with fillRect and requestAnimationFrame. 5 min
9
Project: Canvas mini gameProject
5 lessons · 25 min
  1. 1 Project: Canvas mini game Overview of the 5-lesson canvas mini-game project: scene, motion, collision and game loop. 4 min
  2. 2 Scene and player Set up a scene and player drawing on a canvas 2D context. 5 min
  3. 3 Motion and interaction Move the player with the keydown event and update position in the game loop. 5 min
  4. 4 Collision detection Check whether two rectangles collide with a bounding-box test. 5 min
  5. 5 Project final - Mini game Finalize the mini game and run scene, motion and collision flow. 6 min
10
Advanced Intl
6 lessons · 30 min
  1. 1 Intl.NumberFormat Learn locale-aware number and currency formatting with Intl.NumberFormat. 5 min
  2. 2 Intl.PluralRules Learn to pick a plural category per locale with Intl.PluralRules. 5 min
  3. 3 Intl.Collator Learn locale-aware sorting and comparison with Intl.Collator. 5 min
  4. 4 Intl.ListFormat Learn to join a list with locale-appropriate conjunctions with Intl.ListFormat. 5 min
  5. 5 Intl.RelativeTimeFormat Learn to format relative-time phrases like '3 days ago' with Intl.RelativeTimeFormat. 5 min
  6. 6 Summary - Advanced Intl Build a notification message generator with Intl.NumberFormat, PluralRules and ListFormat. 5 min
11
Expert finalFinal
5 lessons · 30 min
  1. 1 Challenge - Performance optimization Build a search-suggestion function with memoization, debounce and performance measurement. 6 min
  2. 2 Challenge - Worker architecture Run a heavy computation in a background thread with Web Workers and transferable objects. 6 min
  3. 3 Challenge - Validation with Proxy Build a wrapper that validates a settings object's properties with Proxy and Reflect. 6 min
  4. 4 Challenge - Canvas game flow Build a ball-and-basket game with canvas, requestAnimationFrame and collision detection. 6 min
  5. 5 Challenge - Secure app Build a secure form app with XSS-safe rendering, CSP and input sanitization. 6 min

Lessons are free, an account keeps your progress

You do not have to sign up. If you do, you continue where you left off and never lose your work.

  • Progress saved on every device
  • Earn XP and badges
  • Keep your daily streak
  • Get a certificate when you finish
create a free account

Frequently asked questions

Are the JavaScript lessons free?

Yes. All 430 lessons of the JavaScript course are free and you can start without an account.

Do I need any prior knowledge?

No. The beginner level starts from zero; a browser is all you need. If you already know the basics, start at a higher level.

How long does the course take?

Lessons take 2–8 minutes. The whole course is about 36 hours; with 15–20 minutes a day you can finish in a few months.

Do I get a certificate?

Yes. When you complete the course with a free account, a verifiable certificate is issued in your name.

Will I lose my progress without an account?

Without an account your progress is kept only in your current browser. When you create a free account it is moved to your account.

Next step PHP

Learn modern PHP 8.3 from variables to OOP, PDO and expert topics with hands-on projects.