A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-46.js
1queueMicrotask(()=>console.log('micro'));
2setTimeout(()=>console.log('macro'),0);
3console.log('sync');
Async
Answer & explanation
Console output
sync
micro
macro
Why
queueMicrotask adds a callback to the microtask queue, the same one promise reactions use. The order is always: current synchronous code, then the full microtask queue, then the next macrotask (timer). So "sync", "micro", "macro" is deterministic.