Why is this asked in Node.js interviews?
It tests understanding of Event Loop phases and callback scheduling.
Explore This Question
Search for additional explanations using these tools:
More FAQs in Difference Between setTimeout() and setImmediate() in Node.js
setTimeout() executes in the Timers Phase, while setImmediate() executes in the Check Phase of the Event Loop.
The order is not always guaranteed. It depends on the Event Loop state and execution context.
No. It schedules the callback for the Timers Phase after at least the specified delay.
Still have questions?
Browse all our FAQs or reach out to our support team
