Skip to content

Instantly share code, notes, and snippets.

@AliSawari
Created June 4, 2019 13:31
Show Gist options
  • Save AliSawari/460ac9911edcc27aed052a951d8cba9a to your computer and use it in GitHub Desktop.
Save AliSawari/460ac9911edcc27aed052a951d8cba9a to your computer and use it in GitHub Desktop.
the arguments in then calls are the returns of the previous ones
// with each return , the value goes for the next then in chain
// you can chain as many thens as you want, even if you dont return a value
doSomething(args).then(result => {
return result + 2
}).then(plusTwo => {
return plusTwo + 2
}).then(plusFour => {
// and the chain continues as many thens as you want...
}).catch(err => console.log(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment