Skip to content

Commit e2828b8

Browse files
authored
fix(learn): improve the learn Asynchronous Work doc (#7682)
* fix: improve 'Understanding process.nextTick()' page example code. * feat: add summary for understanding processnexttick doc * fix: add a link for the "order of events" * fix: use more clear words to summary * fix: use doc link instead of example code * fix: change the summary words * fix: fix error link
1 parent 9c2357d commit e2828b8

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,4 @@ Calling `setTimeout(() => {}, 0)` will execute the function at the end of next t
2525

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

28-
#### An Example of the order of events:
29-
30-
```js
31-
console.log('Hello => number 1');
32-
33-
setImmediate(() => {
34-
console.log('Running before the timeout => number 3');
35-
});
36-
37-
setTimeout(() => {
38-
console.log('The timeout running last => number 4');
39-
}, 0);
40-
41-
process.nextTick(() => {
42-
console.log('Running at next tick => number 2');
43-
});
44-
```
45-
46-
#### Example output:
47-
48-
```bash
49-
Hello => number 1
50-
Running at next tick => number 2
51-
Running before the timeout => number 3
52-
The timeout running last => number 4
53-
```
54-
55-
The exact output may differ from run to run.
28+
To learn more about the order of execution and how the event loop works, check out [the dedicated article](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick)

0 commit comments

Comments
 (0)