Stdle #77 · async · 2026-08-16
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
1function delay(v) { return new Promise(res => setTimeout(() => res(v), 0)); }2const r = await delay(1) + await delay(2);3console.log(r);
Console output
Why
Each await suspends until its promise resolves, yielding the underlying value. The expression awaits delay(1) to get 1, then awaits delay(2) to get 2, and adds them. The awaits run sequentially (one after the other), and the final sum is 3.