Statements after an await are deferred to a microtask, so they run after the surrounding synchronous code finishes.
Codejavascript
let result = 0;
async function compute() {
result = 10;
await Promise.resolve();
result = 20;
}
compute();
// expected to print 20
console.log(result);