JavaScript exercises with solutions

60 practice problems from the 20 lessons of the JavaScript: Programming for the Web course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

20 easy problems 20 medium problems 20 hard problems

JavaScript and the web

3 problems · Read the lesson

Values, variables and types

3 problems · Read the lesson

Decisions: if, else and switch

3 problems · Read the lesson

Loops

3 problems · Read the lesson

Working with text and numbers

3 problems · Read the lesson

Functions and the call stack

3 problems · Read the lesson

Arrays

3 problems · Read the lesson

Objects

3 problems · Read the lesson

Array methods: forEach, map, filter and reduce

3 problems · Read the lesson

Destructuring, spread and safe access

3 problems · Read the lesson

Maps and Sets

3 problems · Read the lesson

Scope and closures

3 problems · Read the lesson

Classes and prototypes

3 problems · Read the lesson

Errors: throw, try and catch

3 problems · Read the lesson

Asynchronous JavaScript: event loop, promises, async/await

3 problems · Read the lesson

Modules: splitting a program into files

3 problems · Read the lesson

HTML and CSS

3 problems · Read the lesson

The DOM: changing the page with JavaScript

3 problems · Read the lesson

Events and forms

3 problems · Read the lesson

Fetching data and saving it

3 problems · Read the lesson