Explore Library
Quiz

Event Loop & Await Ordering

Understand how microtasks from resolved promises are prioritized over macrotasks like setTimeout in the event loop.

In a running Node.js script, a Promise callback (via .then or resumed await) and a setTimeout(fn, 0) callback are both queued at nearly the same time. Which runs first and why?