Hint
Promise.all result order matches INPUT order, not resolution order.
async function delay(ms, val) {
await new Promise(r => setTimeout(r, ms));
return val;
}
const [a, b, c] = await Promise.all([
delay(300, 'slow'),
delay(100, 'fast'),
delay(200, 'medium')
]);
console.log(a, b, c);slow fast medium
Explanation: Promise.all preserves the order of results matching the input array β regardless of which resolves first. "fast" finishes first but appears second in results.
Key Insight: Promise.all result order matches INPUT order, not resolution order.