10 JavaScript exercises, freeStart

Free coding practice with hints that help

Write real JavaScript, run the tests, and when something fails, get a hint about what your code actually did. Everything runs in your browser. No account, no install, no cost.

06 FizzBuzz · Medium
1function fizzBuzz(n) {
2 const result = [];
3 for (let i = 1; i <= n; i++) {
4 if (i % 3 === 0) result.push("Fizz");
5 else if (i % 5 === 0) result.push("Buzz");
6 else if (i % 15 === 0) result.push("FizzBuzz");
7 else result.push(String(i));
8 }
9 return result;
10}

2 of 3 tests passed

  • fizzBuzz(5)
  • fizzBuzz(1)
  • fizzBuzz(15) · item 15 is "Fizz"

What the tests saw

Your 15 says "Fizz". Check for multiples of both 3 and 5 before checking 3 on its own.

Practice that tells you why

Real tests

Each exercise calls your function with fixed inputs and checks every answer.

Hints from your code

Failing output is matched against common mistakes, so the hint fits what you wrote.

Hints one at a time

Ask for the next nudge only when you need it. The answer comes last, if at all.

Plain error messages

Syntax, reference and type errors explained in words a beginner can act on.

Loop protection

Code that runs longer than 2 seconds is stopped, so the page never freezes.

Warm-up to medium

From adding two numbers to counting words, each one practising one idea.

Saved on your device

Your code and solved exercises stay in this browser between visits.

Private by design

No account and no server. Your code is never sent anywhere.

Questions and answers

Ten exercises. One idea each. Free.