Skip to content

Instantly share code, notes, and snippets.

@rice10t
Created June 3, 2016 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rice10t/77346d9da4678bf388ac8476e687f4a0 to your computer and use it in GitHub Desktop.
Save rice10t/77346d9da4678bf388ac8476e687f4a0 to your computer and use it in GitHub Desktop.
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