Skip to content

Instantly share code, notes, and snippets.

@smagch
Created September 6, 2016 11:59
Show Gist options
  • Save smagch/61df8e2e82c4a360e7a54aa6e792009d to your computer and use it in GitHub Desktop.
Save smagch/61df8e2e82c4a360e7a54aa6e792009d to your computer and use it in GitHub Desktop.
Promise
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