Created
June 11, 2024 04:46
-
-
Save darkwing/ab3b10ef33a95266f9debd5eb1751e7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const result = await Promise.race([ | |
new Promise((resolve, reject) => { | |
setTimeout(() => resolve('result!'), 2000); | |
}), | |
new Promise((resolve, reject) => { | |
setTimeout(() => reject('booo!'), 1000); | |
}) | |
]); | |
console.log("result is: ", result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment