Node.js · Junior · Question 34 of 75
What is the order of the output?
console.log("A");
setTimeout(() => console.log("B"), 0);
console.log("C");- 1A, B, C
- 2B, A, C
- ✓Correct answer: A, C, B
Explanation
The timer callback goes into the event loop queue and runs only after the current synchronous code finishes, even with a 0 ms delay.