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");

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.

Further reading

Problem with a question

Node.js · Junior · question 34

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz