title: Execution order for setTimeout and Promise.then
body: <p>Let say we have the following snippet. Can someone explain what you expect to print out and why?</p>
  
  <pre><code>setTimeout(() =&gt; {
      console.log("check 00");
  }, 0);
  
  new Promise((resolve, reject)=&gt;{
      console.log("check 01");
      resolve();
  }).then(()=&gt;{
      console.log("check 02");
  })
  
  console.log("check 03");
  </code></pre>
  
  <p>By running in the terminal, I got the following output.</p>
  
  <pre><code>check 01
  check 03
  check 02
  check 00
  </code></pre>
  
  <p>I understand <code>check 01</code> will be printed out first because Promise executor function is executed immediately by the Promise implementation. Then we have <code>check 03</code> because of JS's run-to-completion scheduling.</p>
  
  <p>But what about <code>check 02</code> and <code>check 00</code>?</p>