Skip to content

Instantly share code, notes, and snippets.

@AshanthaLahiru
Last active April 29, 2018 11:50
Show Gist options
  • Save AshanthaLahiru/0b2e9a374bcef53b41b22543ac3b2475 to your computer and use it in GitHub Desktop.
Save AshanthaLahiru/0b2e9a374bcef53b41b22543ac3b2475 to your computer and use it in GitHub Desktop.
Performance of promise
promise(1000) // |-----|
.then(msg => {
console.log(msg)
})
promise(2000) // |-----|-----|
.then(msg => {
console.log(msg)
})
promise(3000) // |-----|-----|-----|
.then(msg => {
console.log(msg)
})
// Result
/*
Promise 1000 start
Promise 2000 start
Promise 3000 start
Promise 1000 end
Promise 2000 end
Promise 3000 end
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment