Stdle #49 · async · 2026-07-19
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
1const arr = [1, 2, 3];2const results = await Promise.all(arr.map(async x => x * 2));3console.log(results.join(','));
Console output
Why
Marking the map callback async means each call returns a promise that resolves to x * 2, even though the body has no await. Promise.all waits for all of them and collects the results in array order, producing [2, 4, 6].