Language concepts

process.nextTick()

Try the free JavaScript compiler

Node-specific queue for callbacks before continuing host event-loop processing at relevant boundaries. Ordering relative to promise microtasks depends on execution context; recursive next ticks can starve later work. Multi-file example: save each listed file separately, then run the entry file with Node.js. See the packaged fixture for the original files.

Formal Syntax & Structure

javascript syntaxjavascript
process.nextTick(callback, ...args)

Parameters & Attributes

NameTypeDescription
callbackfunctionCallback to invoke.
argsany[]Arguments forwarded to the callback.

Return Value

undefined

No return value.

Working Example

Example Snippetjavascript
// File: main.cjsprocess.nextTick(()=>console.log("tick"));queueMicrotask(()=>console.log("micro"));console.log("sync");
JavaScript Reference