js 代码执行顺序
作者:互联网
async function async1() {
console.log('async1 start')
await async2()
console.log('async1 end')
}
async function async2() {
console.log('async2')
}
async1()
console.log('script start')
// js是单线程的 是非阻塞的 我们去掉await 再看结果
function async1() {
console.log('async1 start')
async2()
console.log('async1 end')
}
function async2() {
console.log('async2')
}
async1()
console.log('script start')
结果符合我们的预期。
标签:async2,function,async1,console,log,js,start,顺序,代码执行 来源: https://blog.csdn.net/u012174809/article/details/122557314