@@ -3,9 +3,9 @@ let seconds = 0;
33let minutes = 0 ;
44let timer ;
55
6- const startButton = document . getElementById ( " start" ) ;
7- const stopButton = document . getElementById ( " stop" ) ;
8- const resetButton = document . getElementById ( " reset" ) ;
6+ const startButton = document . getElementById ( ' start' ) ;
7+ const stopButton = document . getElementById ( ' stop' ) ;
8+ const resetButton = document . getElementById ( ' reset' ) ;
99
1010const updateTime = ( ) => {
1111 milliseconds += 1 ;
@@ -17,12 +17,9 @@ const updateTime = () => {
1717 seconds = 0 ;
1818 minutes += 1 ;
1919 }
20- document . getElementById ( "milliseconds" ) . innerText =
21- milliseconds < 10 ? `0${ milliseconds } ` : milliseconds ;
22- document . getElementById ( "seconds" ) . innerText =
23- seconds < 10 ? `0${ seconds } ` : seconds ;
24- document . getElementById ( "minutes" ) . innerText =
25- minutes < 10 ? `0${ minutes } ` : minutes ;
20+ document . getElementById ( 'milliseconds' ) . innerText = milliseconds < 10 ? `0${ milliseconds } ` : milliseconds ;
21+ document . getElementById ( 'seconds' ) . innerText = seconds < 10 ? `0${ seconds } ` : seconds ;
22+ document . getElementById ( 'minutes' ) . innerText = minutes < 10 ? `0${ minutes } ` : minutes ;
2623} ;
2724
2825const startTimer = ( ) => {
@@ -39,11 +36,11 @@ const resetTimer = () => {
3936 milliseconds = 0 ;
4037 seconds = 0 ;
4138 minutes = 0 ;
42- document . getElementById ( " milliseconds" ) . innerText = "00" ;
43- document . getElementById ( " seconds" ) . innerText = "00" ;
44- document . getElementById ( " minutes" ) . innerText = "00" ;
39+ document . getElementById ( ' milliseconds' ) . innerText = '00' ;
40+ document . getElementById ( ' seconds' ) . innerText = '00' ;
41+ document . getElementById ( ' minutes' ) . innerText = '00' ;
4542} ;
4643
47- startButton . addEventListener ( " click" , startTimer ) ;
48- stopButton . addEventListener ( " click" , stopTimer ) ;
49- resetButton . addEventListener ( " click" , resetTimer ) ;
44+ startButton . addEventListener ( ' click' , startTimer ) ;
45+ stopButton . addEventListener ( ' click' , stopTimer ) ;
46+ resetButton . addEventListener ( ' click' , resetTimer ) ;
0 commit comments