Completed
Available
Locked · open anytime

Level 1: Beginner JavaScript Exercises

Level 1 takes you from your first console.log to a function that sums up a todo list. Each exercise is a tiny job from real web work — a price label, a page title, an HTML tag — so you practise the code you will actually write.

Every lesson also names one trap that trips up beginners, like == versus === or why arr[-1] gives undefined. Your code runs in your browser and the tests check it as soon as you click Run Tests.

The 11 exercises in this level

  1. 1 Hello, JavaScript Functions and template literals Write your first JavaScript function, build text with template literals and print it with console.log. Start here — no prerequisites
  2. 2 let & const Values that change, values that don't Store values with let when they will change and const when they won't, and see what JavaScript does when you try to reassign a constant. Recommended first: Hello, JavaScript
  3. 3 Numbers & Prices Arithmetic and toFixed Do arithmetic with JavaScript numbers and turn a price stored in cents into a label with exactly two decimals. Recommended first: Hello, JavaScript
  4. 4 Strings Measure, cut and search text Clean up and slice text with string methods to build the two-letter avatar label you see in chat apps. Recommended first: Hello, JavaScript
  5. 5 if / else & === Decisions and strict equality Make decisions with if / else and the ternary operator, and learn why JavaScript developers compare with === instead of ==. Recommended first: Numbers & Prices
  6. 6 Truthy & Falsy Defaults with ?? and || Find out which values count as false in a condition and give missing settings a default without wiping out a real 0 or empty string. Recommended first: if / else & ===
  7. 7 Arrays Ordered lists of values Keep values in order in an array, add to it with push and read the last item the right way with at(-1). Recommended first: Hello, JavaScript
  8. 8 Loops with for…of Visit every item Walk through an array with for…of and keep a running count in an accumulator variable. Recommended first: Arrays, if / else & ===
  9. 9 Arrow Functions Short functions and default values Write compact arrow functions with default parameters by building the HTML tags a page is made of. Recommended first: Strings
  10. 10 Objects Named values together Group a product's details in an object, read them by name and turn them into a short label for a shop page. Recommended first: Arrays
  11. 11 Project: Todo Summary Loops, objects and functions together Combine a loop, objects and a condition to write the status line under a todo list, the kind every task app shows. Recommended first: Loops with for…of, Objects, Arrow Functions

Frequently asked questions

Do I need to install anything?
No. Browsers run JavaScript already, so you write and test code on this page. No Node.js, no editor, no account.
Why does JavaScript have both == and ===?
`==` converts values before comparing, so `0 == ""` is `true`. `===` also checks the type and is what you want almost every time. The "if / else & ===" exercise shows the difference.
Is this the same JavaScript used on real websites?
Yes. It is modern standard JavaScript, the same language that runs in every browser and in Node.js. This level focuses on the language itself; changing web pages comes later.
What should I do when a test fails?
Read the expected and actual values side by side — they usually point at the mistake. You can also add `console.log` lines; whatever you print shows up in the output panel.