+ 1

When n.innerHTML < 0 it doesn't give me an alert why?

https://code.sololearn.com/Wzxfio8mM2cg/?ref=app I am making a timer so when n.innerHTML < 0 I want the counting down to stop

5th Mar 2021, 7:33 PM
Radwa Hamdy
5 Answers
5th Mar 2021, 10:24 PM
visph
visph - avatar
+ 3
because it is still stuck at setInterval() , you should set pause function that will execute when it n reaches 0 (by using clearInterval()) also i suggest you to refactor your code it is not a clean code this is how i handle it https://github.com/NimaPoshtiban/JavaScript-Projects-timer/blob/master/timer.js
5th Mar 2021, 8:16 PM
Nima
0
I am making a timer so when n.innerHTML < 0 I want the counting down to stop
5th Mar 2021, 7:58 PM
Radwa Hamdy
0
Thanks
5th Mar 2021, 8:18 PM
Radwa Hamdy