Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ferreiratiago/205d36c9e3c5ce04b8d86155a8df796f to your computer and use it in GitHub Desktop.
Save ferreiratiago/205d36c9e3c5ce04b8d86155a8df796f to your computer and use it in GitHub Desktop.
Resolve multiple promises sequentially
(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