const promise1 = new Promise((_,reject) => setTimeout(reject, 10, 'quick_reject')); const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 'quick_resolve')); const promise3 = new Promise((resolve) => setTimeout(resolve, 500, 'slow_resolve')); const promises = [promise1, promise2, promise3]; Promise.race(promises).then((value) => console.log(value)).catch((error) => { console.log(error) }); // rejectが一番初めに解決されるpromise1のquick_rejectが出力される