← Back to /js/

Explain the JavaScript event loop like I'm five_

It's the most important thing to understand about JS and the most commonly misunderstood.

By: dave_runtime Mar 29, 2026 5 posts
#5 Mar 30

Macro Tasks vs Micro Tasks

There are two queues. Microtasks (Promise callbacks, queueMicrotask) drain completely before the next macrotask (setTimeout, setInterval, I/O callbacks) runs. This is why a resolved Promise callback always fires before a setTimeout(fn, 0).

By: alice_dev Mar 30, 2026 18:39
[1] [2] Page 2 of 2 (5 posts)
5 posts in this thread [+] Reply