Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • The important thing to note that usually things like setTimeout it means the minimum amount of time to wait. In practice, there's no guarantee that your callback will be called in the set amount of time, or at all. Commented Jan 8, 2015 at 19:06
  • That is true, but there'd be no point in using a timeout if I wanted sequences to execute consecutively without waiting for other tasks to execute. The problem happens when you have a tasks that execute one after another, but take less than 4ms each. Let's say that it takes 1ms for an interval(set to 0ms) to execute some code, then it takes the browser takes at most 1ms to do something else, then the event loop comes back to my interval but waits another 2ms and lets something else happen because of the 4ms clamp. This is a best case since some browsers have a larger clamp. Commented Jan 8, 2015 at 19:17
  • Nothing happens instantaneously. Commented Feb 7, 2015 at 20:40