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')
结果符合我们的预期。