const contestants = [ new Promise((r) => setTimeout(() => r("a"), 1000)), new Promise((r) => setTimeout(() => r("b"), 1000)), new Promise((r) => setTimeout(() => r("c"), 1000)) ]; (async () => console.log(await Promise.race(contestants)))();