CodeZettaInterview Hub

Node.js · Event Loop · Junior · Comparison

What is the difference between `process.nextTick` and `Promise.then` / queueMicrotask?

Short Interview Answer

nextTick runs before other microtasks and can starve the event loop if recursively scheduled; Promise microtasks are the standard ES queue.

Detailed Explanation

Prefer promises/queueMicrotask for app logic. nextTick is for ensuring callbacks run before I/O continues — use sparingly. Recursive nextTick is a classic hang.

Common Mistake

Using nextTick as a general async deferral tool.

Did you know this answer?