Result and execution phases
The output is A, E, C, D, then B. The browser starts by running the script as the current task. console.log('A') runs immediately, setTimeout makes its callback eligible for a later task, and Promise.then queues a microtask. The final synchronous statement logs E. Only after the script's call stack is empty does the browser begin the microtask checkpoint, so the Promise callback logs C before the timer can run.