Core Concepts: Understanding process.nextTick()

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


As you try to understand the Node.js event loop, one important part of it is process.nextTick().

Every time the event loop takes a full trip, we call it a tick.

When we pass a function to process.nextTick(), we instruct the engine to invoke this function at the end of the current operation, before the next event loop tick starts:

process.nextTick(() => {
  //do something
})

The event loop is busy processing the current function code.

When this operation ends, the JS engine runs all the functions passed to nextTick calls during that operation.

It’s the way we can tell the JS engine to process a function asynchronously (after the current function), but as soon as possible, not queue it.

Calling setTimeout(() => {}, 0) will execute the function at the end of next tick, much later than when using nextTick() which prioritizes the call and executes it just before the beginning of the next tick.

Use nextTick() when you want to make sure that in the next event loop iteration that code is already executed.

Lessons in this unit:

0: Introduction
1: The Node Core Modules
2: Differences between Node and the Browser
3: Node, the difference between development and production
4: The Node.js Event Loop
5: A brief history of Node.js
6: ▶︎ Understanding process.nextTick()
7: Understanding setImmediate()
8: How to check the current Node.js version at runtime
9: Why should you use Node.js in your next project?
10: Introduction to Node.js