A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-60.js
1console.log('A');
2(async()=>{
3console.log('B');
4awaitPromise.resolve();
5console.log('C');
6})();
7console.log('D');
Async
Answer & explanation
Console output
A
B
D
C
Why
The immediately-invoked async function executes synchronously up to the await, so "A" then "B" print in order. At the await the function suspends, scheduling the rest ("C") as a microtask, so the synchronous "D" runs next. Once the call stack clears, the microtask resumes and "C" prints last.