then chain nodejs code example
Example: javascript promise chain
// base case
promise
.then(...)
.then(...)
.then(...)
.catch(...)
//real world
coinflip(10)
.then(betAgain)
.then(betAgain)
.then(betAgain)
.then(result => {
console.log(`OMG, WE DID THIS! TIME TO TAKE ${result} HOME!`);
})
.catch(handleRejection);