Interview Hub
Sign in

Q11: `process.nextTick` vs `setImmediate`?

HardNode.js 29

Answer

nextTick runs before the next event loop phase (still part of the current turn in a sense — can starve I/O if abused). setImmediate runs in the check phase after poll. Prefer setImmediate for deferring to avoid I/O starvation; use nextTick sparingly for breaking up sync work or ensuring ordering before other I/O.

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

EditorJavaScript · local only
`process.nextTick` vs `setImmediate`? | TorqStudio Interview Hub