nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

Clarify setImmediate not always run before setTimeout at main module in the learn Asynchronous Work doc

Open kekekuli opened this issue 8 months ago • 2 comments

Affected URL(s)

https://nodejs.org/en/learn/asynchronous-work/understanding-processnexttick

Description of the problem

In that doc, here is an example code to explain how the nextTick() API affect the execute order. It is right for the nextTick() part. But readers will quickly get messy when they see the output example saying that the setImmediate always have higher order than setTimeout , while both at top-level. The other doc have pointed out that behavior.

So it is better to chang the setimmediate-vs-settimeout part in the example code in that doc.

kekekuli avatar Apr 24 '25 14:04 kekekuli

Hello, @avivkeller. I have made changes based on your advise, please let me know if you'd like any adjustments!

kekekuli avatar Apr 24 '25 15:04 kekekuli

For future reference, it's much easier to review if you leave comments regarding the PR on the PR, rather than on the issue. I've responded to your PR with additional comments.

Thank you!

avivkeller avatar Apr 24 '25 15:04 avivkeller