
Promise.race() – Returns the result of the first promise to settle (fulfilled or rejected).
๐ Syntax
Promise.race([p1, p2]).then(fastest => {
// first resolved value
});
๐งช Example
Promise.race([
fetch('/slow'), fetch('/fast')
]).then(result => console.log(result));
Comments
Post a Comment