Intermediate
Fix the stopwatch that won't stop
This stopwatch keeps its interval id in a normal variable, so Stop doesn't work. Fix it with a ref.
Keep the ids: the time shows in id="time" (it starts at 0.0), and the buttons are id="start", id="stop" and id="reset". Reset stops the clock and shows 0.0.
Pressing Start twice must not make the clock run faster.
What Check tests
- It starts at
0.0 - Start makes the time go up
- Stop really stops the clock
- Reset shows
0.0and stays there - Pressing Start twice doesn't make it run twice as fast
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.