function first(){
console.log("1")
}
function second(){
new Promise ((resolve,reject)=>{
setTimeout(function(){
console.log("2")
resolve();
} ,0);
})
}
function third(){
console.log("3")
}
async function run(){
first();
await second();
third();
}
run();
需要使函数调用同步以获得最终输出 1,2,3 我尝试创建 promise 并使用 async await 但这对任何其他方式都没有帮助
白板的微信
相关分类