Created
May 6, 2017 18:20
-
-
Save ferreiratiago/205d36c9e3c5ce04b8d86155a8df796f to your computer and use it in GitHub Desktop.
Resolve multiple promises sequentially
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
(async function () { | |
// Wait for the first promise to be fulfilled. | |
var a = await getRandomWithPromise(); | |
// Wait for the second promise to be fulfilled. | |
var b = await getRandomWithPromise(); | |
console.log(`Your random numbers are ${a} and ${b}!`); | |
})(); | |
// [Execution Time] 0.490 ms total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment