Created
September 6, 2016 11:59
-
-
Save smagch/61df8e2e82c4a360e7a54aa6e792009d to your computer and use it in GitHub Desktop.
Promise
This file contains 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
Promise.resolve(100).then(num => { | |
console.log('num: ', num); | |
return num + 100; | |
}).then(num => { | |
console.log('num2:', num); | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log('timeout'); | |
resolve('World'); | |
}, 1000); | |
}) | |
}).then(message => { | |
console.log('Hello ', message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment