Promise.any()
ES2021+Returns a promise that fulfills when any of the promises fulfills, or rejects if all of the promises reject.
Syntax
Promise.any(iterable)Parameters
iterable Iterable An iterable of promises
Return Value
Promise
A Promise that fulfills with the first fulfilled promise
Examples
JavaScript
Promise.any([
Promise.reject('에러1'),
Promise.resolve('성공!'),
Promise.reject('에러2')
]).then(value => console.log(value)); Output:
// '성공!'