Created
June 3, 2016 01:35
-
-
Save rice10t/77346d9da4678bf388ac8476e687f4a0 to your computer and use it in GitHub Desktop.
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
const promise = value => { | |
return new Promise(resolve => { | |
setTimeout( | |
resolve.bind(this, value), | |
600 | |
); | |
}); | |
} | |
const show = value => { | |
console.log(value); | |
return value; | |
} | |
const increment = value => value + 1; | |
promise(1000).then(show).then(increment) | |
.then(promise).then(show).then(increment) | |
.then(promise).then(show); | |
// output: | |
// 1000 | |
// 1001 | |
// 1002 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment