Javascript setTimeout timing reliability

Viewed 1347

I have recently started exploring Javascript in more detail, and how it executes within the browser. Specifically, the setTimeout function.

My understanding is that calling setTimeout(foo,x) will pass a handle to foo to be executed after x milliseconds. How reliable is this timing? Obviously if another long-running script is still executing after x milliseconds then the browser won't be able to call foo, but can I be absolutely certain that setTimeout(foo,101) will always be executed after setTimeout(foo,100)?

2 Answers
Related