1
function GenFunc () {
new Promise(function(resolve) {
resolve()
}).then(function() {
console.log("1")
})
console.log("2")
}
GenFunc()
//
// 2
// 1
2
async function GenFunc () {
new Promise(function(resolve) {
resolve()
}).then(function() {
console.log("1")
})
await "string";
console.log("2")
}
GenFunc()
//
// 1
// 2
ask why await changed the order of execution. Promise.then belongs to microtasks. Synchronize"s code will not enter microtasks until it has been executed. So what is the reason for the inconsistency between the two pieces of code