Stopwatch Lab
Medium
33
2
70.2% Acceptance
In this lab, you will build a simple stopwatch where timer will update the elapsed time at a certain interval.
Concepts covered in this lab are:
- Manipulating the DOM
- Adding event listeners
setInterval
andclearInterval
- Date object
- Timer functionality
Steps
- Create a button with id
startBtn
for starting the timer - Create a button with id
stopBtn
for stopping the timer - Create a button with id
resetBtn
for resetting the timer to 0 - Create a paragraph tag with id
timerDisplay
to show the timer - Create separate click handlers for all the buttons to handle the click event
- The stopwatch should update every
10ms
(10 milliseconds)
There are no specific tests for testing the stopwatch functionality, make sure to test the functionality yourself after buildilng. Try to use the best user experience practices like disabled buttons when they shouldn't be active.