Fulfill-reject competitive race. Return a promise that will settle to the same state as the earliest input promise to settle.
Promise.race(promises)
Fulfill-reject competitive race. Return a promise that will settle to the same state as the earliest input promise to settle.
Parameters
-
promises
{array}
array of promises to race
WARNING: The ES6 Promise spec requires that race()ing an empty array must return a promise that is pending forever. This implementation returns a singleton forever-pending promise, the same singleton that is returned by Promise.never(), thus can be checked with ===
to the same outcome as the earliest input promise to settle. if empty is empty, returns a promise that will never settle.