Skip to content

Instantly share code, notes, and snippets.

@risentveber
Last active September 26, 2016 09:32
Show Gist options
  • Save risentveber/1a530be0fe25c103c0a025bbfe926f6a to your computer and use it in GitHub Desktop.
Save risentveber/1a530be0fe25c103c0a025bbfe926f6a to your computer and use it in GitHub Desktop.
new Promise(function(resolve){
setTimeout(function() {
console.log(1);
resolve();
}, 1000);
}).then(function() {
let nextPromise = new Promise(function(resolve){
setTimeout(function() {
console.log(2);
resolve();
}, 1000);
});
return nextPromise;
}).then(function() {
let nextPromise = new Promise(function(resolve){
setTimeout(function() {
console.log(3);
resolve();
}, 1000);
});
return nextPromise;
}).then(function() {
setTimeout(function() {
console.log(4);
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment