Skip to content

Commit 8d9abaf

Browse files
committed
feat: add summary for understanding processnexttick doc
1 parent e5a3b87 commit 8d9abaf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/site/pages/en/learn/asynchronous-work/understanding-processnexttick.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@ Running at order 3 or 4, setImmediate
5252
Running at order 3 or 4, setTimeout
5353
```
5454

55-
The exact output may differ from run to run. [setImmediate vs setTimeout](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#setimmediate-vs-settimeout) explain the reason.
55+
In that case, `console.log('Hello => number 1');` will first run because event loop only starts after call stack is cleared.The `nextTick` queue is processed before entering the next phase, which is why the `process.nextTick()` callback runs immediately after.
56+
57+
The execution order of `serImmediate` and `setTimeout` can not be determined in the main module. For a detailed explanation, refer to [setImmediate vs setTimeout](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#setimmediate-vs-settimeout).

0 commit comments

Comments
 (0)