+ 4

[Solved] Why are second increasing very slow?

I made an stopwatch with just "if" statements but the seconds are increasing very slowly. Please help me make the time correct. https://code.sololearn.com/WmxebtrYONWT/?ref=app

29th Nov 2020, 11:49 AM
Adil
Adil - avatar
4 Answers
+ 2
Adil Ali you can change `ms = ms + Number(1);` to `ms = ms + Number(4);`
1st Dec 2020, 6:37 PM
o.gak
o.gak - avatar
+ 3
https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers > however, the interval is forced to be at least four milliseconds. So , the timer will be reset to 4ms even if you set it to 1ms at first
29th Nov 2020, 1:03 PM
o.gak
o.gak - avatar
+ 2
How to fix it?
1st Dec 2020, 1:11 PM
Adil
Adil - avatar
+ 2
Thanks
4th Dec 2020, 8:32 PM
Adil
Adil - avatar