title: What's the difference between EventLoop in browsers and node?
body: <pre><code>Promise.resolve().then(() =&gt; {
    console.log('promise2')
    setTimeout(() =&gt; console.log('setTimeout2'))
  })
  setTimeout(() =&gt; {
    console.log('setTimeout1')
    Promise.resolve().then(() =&gt; console.log('promise1'))
  })
  </code></pre>
  
  <p>The result of running code in browser:</p>
  
  <pre><code>promise2 -&gt; setTimeout1 -&gt; promise1 -&gt; setTimeout2
  </code></pre>
  
  <p>but in Node</p>
  
  <pre><code>promise2 -&gt; setTimeout1 -&gt; setTimeout2 -&gt;promise1 
  </code></pre>