Question:
What is the difference between message queue and macrotask queue? Is it the same thing?On Nodejs documentation here it says:
When setTimeout() is called, the Browser or Node.js starts the timer. Once the timer expires, in this case immediately as we put 0 as the timeout, the callback function is put in the Message Queue.
While, in this section, it says:
A setTimeout, setImmediate callback is added to macrotask queue
So, does message queue and macrotask queue is the same thing?
Answer:
It refers to the same thing here. One could say that “message queue” is a more general term, as in “the microtask queue and the macrotask queue are both message queues“.If you have better answer, please add a comment about this, thank you!