Why setInterval() laggs ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why setInterval() laggs ??

I was firing a function every millisecond with setInterval(). But the function was not fired every milliseconds. It was getting lagged. Why is it so and what I can do if I want to fire setInterval() every millisecond without lagging ?

16th Feb 2019, 6:02 AM
Arushi Singhania
Arushi Singhania - avatar
2 Answers
+ 1
Maybe it could do with the function executed by setInterval? Btw this effect is more pronounced with smaller intervals.
16th Feb 2019, 6:23 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar