+ 1
Countdown
Okay, so made a simple countdown and tried using clearInterval when the time reaches 0 but my clear Intterval donât work and it goes below 0 https://code.sololearn.com/W77PeIc8tiiu/?ref=app
12 Answers
+ 2
You didn't assign the timer ID to any variable. And you call setInterval() method in a wrong place (inside the prompt() method).
You need to assign timer ID (returned by setInterval() method) to a variable and use that ID when you want to stop the timer.
https://www.w3schools.com/jsref/met_win_setinterval.asp
+ 1
Okay, one question, so when you get rid of the if(mytime >= 0) and you change the else statement to if(mytime == 0) {
clearInterval(mytime) why doesnt it work when i do tgat?
+ 1
Nevermind i ubdertaand
+ 1
Okay, so isthere any way for me to loop this? I tried but it didnt work
https://code.sololearn.com/W77PeIc8tiiu/?ref=app
+ 1
Okay, ye ye just testing a few rhing so why doesnt this work? FF9900
https://code.sololearn.com/W4L0oiHm4cqx/?ref=app
0
So you always do that?
0
Okay, so why is this not working? My alert for my loase button is not working
https://code.sololearn.com/W4L0oiHm4cqx/?ref=app FF9900
0
Can you explain why mine didnt work so i can undertaand to know what to do next time? FF9900
0
Okay, thanks but why do tou have â?â in the code what do they do? FF9900
0
Thank you this will help me later on! And should i always use window.onload or when should i use it?
0
Okay, trying to add a pause button do you know how to fix?
https://code.sololearn.com/W4L0oiHm4cqx/?ref=app
0
Jeez your good, okay i dont need the pause button, but can gou make me a reset and a start button?