$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #163

What is the output?

setTimeout(() => console.log('a'), 0);
Promise.resolve().then(() => console.log('b'));
console.log('c');
  1. c b a
  2. c a b
  3. a b c
  4. b c a
Synchronous first, then the microtask queue, then the timer macrotask.
Play Problem Solving ▸