console.log('script start');
      
      setTimeout(function () {
        console.log('setTimeout');
      }, 0);
      
      Promise.resolve()
        .then(function () {
          console.log('promise1');
        })
        .then(function () {
          console.log('promise2');
        });
      
      console.log('script end');
(宏)任务
Run script
setTimeout callback
微任务
Promise then
Promise then
JS调用栈
Log
script start
script end
promise1
promise2
setTimeout