Explore Library
Quiz

Microtask vs Macrotask Ordering

Predict execution order when Promises and setTimeout are mixed in the event loop.

Given this code, what is the exact order of the logged output? console.log('A'); setTimeout(() => console.log('B'), 0); Promise.resolve().then(() => console.log('C')).then(() => console.log('D')); console.log('E');