#2js-macro micro tasks

dengshicheng1996dengshicheng19962022/05/10

What is printout order?

console.log('script start');

async function asyncA() {
    await asyncB();
    console.log('asyncA end');
};

async function asyncB() {
    console.log('asyncB end');
};

asyncA()

setTimeout(() => {
    console.log('setTimeout')
}, 0)

new Promise((resolve, reject) => {
    console.log('promise start');
    resolve()
})
.then(() => {
console.log('promise end')
})

console.log('script end')
License Copyright © 2022-present lencx