+ 8
Is this working properly?
After the progress reaches max , does the function still continue counting and slowing down the page ?Or does it stop? https://code.sololearn.com/WZQmH47pO6HJ/?ref=app
3 ответов
+ 6
Use "clearInterval":
var L;
function next(){
if (document.getElementById('progress').value<300){
document.getElementById('progress').value+=5;
}
else clearInterval(L);
}
function start(){
L=setInterval(next,100);
}
+ 6
The set interval will continue until you use clearInterval, but the value of the progress bar will stop at its max, 300.
+ 4
I think it keeps going. Add a console.log to your next function. Let it print something to the screen. This is the best way I know to see if it stops.