Output: a promise callback scheduled inside the first of two setTimeout 0 calls
MediumP2Output
What does this code print?
1setTimeout(() => {2 console.log('timer 1');3 Promise.resolve().then(() => console.log('microtask'));4}, 0);5setTimeout(() => console.log('timer 2'), 0);6console.log('sync');
Saved automatically
One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).
Hints
Saved automatically