Use JavaScript's timing functions setInterval
and setTimeout
to create a stopwatch. The stopwatch will have four capabilities:
- In Class:
- a start button that begins incrementing the stopwatch time. Time will be tracked in minutes, seconds, and fractional seconds to two decimal places. Example time: 4:54.05
- a stop button that pauses the stopwatch time.
- As Homework
- a lap button that records the current stopwatch time into an Array. Whenever a new lap is recorded, update the DOM with a list showing all the recorded lap times.
- a reset button that immediately resets the stopwatch time to 0:00.00 and clears all the recorded lap times.