>_
new2coding
browse
topics
about
random
browse/
search
All
AI
Building software
Computers
Computer science
Databases
Infrastructure
Mobile
Networks
Programming languages
Security
The web
Tools
1 result
languages/javascript-s-event-loop-why-settimeout-0-runs-after-the-code-below-it.md
JavaScript's event loop: why setTimeout(…, 0) runs after the code below it
Why does `setTimeout(fn, 0)` run after the lines below it, and why does a promise callback beat it? JavaScript has one worker and two…
5 min read · 22 Oct