Interview Hub
Sign in

Q10: What are the main phases of the Node.js event loop?

HardNode.js 29

Answer

Timers → pending callbacks → idle/prepare → poll (I/O) → check (setImmediate) → close callbacks. Between phases, microtasks run. Understanding this helps explain ordering of setImmediate vs setTimeout(fn,0) and why heavy sync work starves I/O.

Having a tech or coding interview? Check 29 JavaScript & Node.js interview questions.

Source: Node.js docs — Event loop

EditorJavaScript · local only