new Promise((resolve, reject) => {
console.log("async1 start");
console.log("async2");
resolve(Promise.resolve());
}).then(() => {
console.log("async1 end");
});
new Promise(function(resolve) {
console.log("promise1");
resolve();
}).then(function() {
console.log("promise2");
}).then(function() {
console.log("promise3");
}).then(function() {
console.log("promise4");
});
the execution result is as follows:
async1 start
async2
promise1
promise2
promise3
async1 end
promise4
ask the Great God to explain why the result is like this.