考察js的宏和微以及线程和任务

     async function async1 () {
       console.log('async1 start');
       await async2()
       await async3()
       console.log('async1 end');
     }
     async function async2 () {
       console.log('async2')
     }
     async function async3 () {
       return new Promise(resolve => {
         console.log('async3')
         resolve()
      })
     }
     async1()
     console.log('script start')
     setTimeout(() => {
       console.log('setTimeout')
     }, 0)
     console.log('script end')
posted @ 2022-11-04 15:35  SultanST  阅读(12)  评论(0编辑  收藏  举报