Skip to content

Instantly share code, notes, and snippets.

@AshanthaLahiru
Last active April 29, 2018 12:00
Show Gist options
  • Save AshanthaLahiru/027def838019dcc08191606608a3c2cf to your computer and use it in GitHub Desktop.
Save AshanthaLahiru/027def838019dcc08191606608a3c2cf to your computer and use it in GitHub Desktop.
Async performance
let tryAsync = async () => {
let msgs = await Promise.all([promise(1000), promise(2000), promise(3000)])
msgs.forEach(msg => {
console.log(msg)
});
console.log(`End of Promise.all(..)`)
}
tryAsync()
//Result
/*
Promise 1000 start
Promise 2000 start
Promise 3000 start
Promise 1000 end
Promise 2000 end
Promise 3000 end
End of Promise.all(..)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment