🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Async JavaScript: all 10 questions

Quiz: Async JavaScript · Question 6 of 10

What does this print? (code)

What does this print?

console.log(1);
setTimeout(() => console.log(2), 0);
console.log(3);
  1. A.1 2 3
  2. B.1 3 2
  3. C.2 1 3
  4. D.1 3
Answer & explanation

Correct answer: 1 3 2

A timer callback waits until the current code finishes, even with a 0 ms delay.

Can you get the rest right without peeking?

Take the timed Quiz: Async JavaScript quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →