JavaScript
31
Вклад в тег
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);
});