promise-面试题2 àì夳堔傛蜴生んèń 2023-03-02 07:42 3阅读 0赞 //3 7 4 1 2 5 //同步3 7 4 /* 宏:[5] 微:[1,2] 最后resolve(6) 返回给p 但是不执行输出了 */ const first= ()=>(new Promise((resolve,reject)=>{ console.log(3) let p=new Promise((resolve,reject)=>{ console.log(7) setTimeout(()=>{ console.log(5) resolve(6) },0) resolve(1) }) resolve(2) p.then((arg)=>{ console.log(arg) }) })) first().then((arg)=>{ console.log(arg) }) console.log(4)
还没有评论,来说两句吧...