+ 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

31st Dec 2018, 11:24 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
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); }
1st Jan 2019, 2:11 AM
Игорь Яковенко
Игорь Яковенко - avatar
+ 6
The set interval will continue until you use clearInterval, but the value of the progress bar will stop at its max, 300.
1st Jan 2019, 1:29 AM
Zeke Williams
Zeke Williams - avatar
+ 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.
1st Jan 2019, 12:01 AM
Kevin Oudai
Kevin Oudai - avatar