nodejs.dev
nodejs.dev copied to clipboard
Wrong description about Job Queue
Documentation Is
- [ ] Missing/Needed
- [x] Incorrect
- [ ] Confusing
- [ ] Not Sure?
Please Explain in Detail
I think the sentence from https://nodejs.dev/learn/the-nodejs-event-loop#es6-job-queue is wrong.
Promises that resolve before the current function ends will be executed right after the current function.
Resolved promises will be executed right after Call Stack is empty, not after current function.
I modified example code on the document. https://codesandbox.io/s/node-playground-forked-iq15wb?file=/src/index.js
Your Proposal for Changes
I think the sentence about current function should be removed and there should be a mention of "after call stack is empty", "higher priority than Callback Queue".