Comment by swsieber

9 hours ago

I think it's still the case. The 4ms happens if you call setTimeout nested several times. I don't know the exact limit. But it's 5-ish times where that kicks in IIRC.

Edit: Here's the MDN bit on that, I was correct:

https://developer.mozilla.org/en-US/docs/Web/API/Window/setT...

> browsers will enforce a minimum timeout of 4 milliseconds once a nested call to setTimeout has been scheduled 5 times.

And the link from there to the spec about that:

https://html.spec.whatwg.org/multipage/timers-and-user-promp...

> If nesting level is greater than 5, and timeout is less than 4, then set timeout to 4.