Created
April 29, 2020 04:22
-
-
Save bitfishxyz/d6e93580e8466bea36c05262a488f109 to your computer and use it in GitHub Desktop.
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
var p = new Promise(function(resolve, reject){ | |
resolve(1); | |
}); | |
p.then(function(value){ //1st then | |
console.log(value); | |
return Promise.resolve(value*2); | |
}).then(function(value){ //2nd then | |
console.log(value); | |
return Promise.resolve(undefined) | |
}).then(function(value){ //3rd then | |
console.log(value); | |
return Promise.resolve('resolve'); | |
}).then(function(value){ //4th then | |
console.log(value); | |
return Promise.reject('reject'); | |
}).then(function(value){ //5th then | |
console.log('resolve: '+ value); | |
}, function(err){ | |
console.log('reject: ' + err); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment