Do you know what will be the output of this code?
JavaScript
async function run() {
console.log(1);
await null;
console.log(2);
}
run();
console.log(3);
Show answer and explanation
The answer is 1 3 2.
An async function runs synchronously until its first await. Then it pauses and control returns to the caller, which logs 3. The rest of run continues as a microtask.