Skip to content

Instantly share code, notes, and snippets.

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