Created
June 4, 2019 13:31
-
-
Save AliSawari/460ac9911edcc27aed052a951d8cba9a to your computer and use it in GitHub Desktop.
the arguments in then calls are the returns of the previous ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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