Run a Stopwatch
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Build a stopwatch that counts ticks. It takes a tick prop, the length of one tick in milliseconds (default 1000), and shows a paragraph reading "Elapsed: 0". A "Start" button starts it: the number goes up by 1 every tick, and while it runs that button reads "Stop" instead. Stop pauses it, keeping the number, and Start carries on from there. A "Reset" button stops it and sets the number back to 0. The checks use a tick of 20 milliseconds.
Your code must pass
- Waits for Start, then counts up
- Stop pauses the count and Start carries on
- Reset stops it and goes back to 0