《js事件循环机制》分享提问

感谢您能抽出几分钟时间来参加本次答题,现在我们就马上开始吧!
答题者
    ____________
下面代码的输出结果是()

console.log(1)

new Promise((resolve, reject) => {

    console.log(2)

    resolve()

}).then(res => {

    console.log(3)

})

console.log(4)

A.1,2,3,4
B.4,3,2,1
C.1,3,2,4
D.1,2,4,3
下面代码的输出结果是()

async function fn1() {

  console.log(1)

  await fn2()

  console.log(2)

 }

 async function fn2() {

  console.log('fn2')

 }

 fn1()

 console.log(3)

A.1,fn2,3,2
B.1,3,2,fn2
C.1,2,fn2,3
下面代码的输出结果是()

setTimeout(() => {

    console.log('a');

});

Promise.resolve().then(() => {

    console.log('b');

}).then(() => {

    return Promise.resolve('c').then(data => {

        setTimeout(() => {

            console.log('d')

        });

        console.log('f');

        return data;

    });

}).then(data => {

    console.log(data);

}); 

A.b f c a d
B.b c f a d
C.a b c d f
D.a b c d f

4题 | 被引用0次

模板修改
使用此模板创建