console.log('script start')asyncfunctionasync1(){awaitasync2()console.log('async1 end')}asyncfunctionasync2(){console.log('async2 end') }async1()setTimeout(function(){console.log('setTimeout')},0)newPromise(resolve=>{console.log('Promise') resolve()}) .then(function(){console.log('promise1') }) .then(function(){console.log('promise2') })console.log('script end')
B解释的顺序是对的
await 后面的并没有放到then里执行,而是简单跟在promise后面
网友评论