Given the following code, when will function go
be executed?
setTimeout(go, 0);
Will it be added to the end of the Job Queue immediately, or added to the end of the Job Queue after the minimum interval for setTimeout
?
Given the following code, when will function go
be executed?
setTimeout(go, 0);
Will it be added to the end of the Job Queue immediately, or added to the end of the Job Queue after the minimum interval for setTimeout
?
Most browsers implement a minimum delay time of 4ms. You can use lower values without error, but when actually executing the script, the browser will overwrite the timeout value.
https://html.spec.whatwg.org/multipage/webappapis.html#timers
with a timeout of 0, it will be added to the end of the job queue immediately