Command Palette

Search for a command to run...

Hectal
Phase 10: Asynchronous JavaScript
JavaScript · Exercise 1 of 5Next
Beginner

A countdown that stops itself

The page shows 3. Every 200 ms, count down: show and log 2, then 1.

After 1, show and log Go! and stop the timer, so nothing else happens afterwards.

Use setInterval for the repeating and clearInterval to stop it.

What Check tests

  1. The page ends on Go!
  2. The console shows 3, 2, 1, Go! in that order
  3. The countdown stops after Go!
  4. Uses setInterval and clearInterval

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.