javascript set interval | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

javascript set interval

hey guys, i made a code with a progress bar so when the setInterval is up, a timeout fades in. Im already done with the code but i dont know whats wrong with it, please help me check my js code, especially the set interval function. If theres anything wrong https://code.sololearn.com/Wk9j38oYKC3l/?ref=app https://code.sololearn.com/Wk9j38oYKC3l/?ref=app

25th May 2022, 11:53 AM
Mikeey
Mikeey - avatar
3 Answers
+ 13
Your interval in the setInterval() is 100ms, progressbar value is 20. This value is reduced by 1 every 100ms. So, the progress bar will be empty is 2 seconds. To make it slower, you can increase the interval or the progressbar value. Or you can decrease the subtracted value: try 0.1 instead of 1. I have a similar project in which I've solved this issue. I hope it helps: https://code.sololearn.com/W81SBc95d9E4/?ref=app
26th May 2022, 2:23 PM
Igor Makarsky
Igor Makarsky - avatar
+ 2
That's not it . I intentionally did that to speed it up.. for a test check
26th May 2022, 9:24 PM
Mikeey
Mikeey - avatar
+ 2
But I read and scaled through your code.... Even though your comment didn't help... Your code did 100% Love this bro I know what to do now Thanks
26th May 2022, 9:35 PM
Mikeey
Mikeey - avatar