title: Why Promise is executed before setTimeout?
body: <p>Here I have written 3 <code>console.log()</code>. Please help me, why <code>Promise</code> is executed before <code>setTimeout</code> even if it has 0 second delay. As per my understanding both <code>setTimeout</code> and <code>Promise</code> are executed in webAPI not in JavaScript Engine. Is this thing is related to priorty?</p>
  
  <pre><code>setTimeout(()=&gt;console.log("SET TIME OUT"),0);  // #1
  
  var promise = new Promise((resolve,reject)=&gt;{
      resolve()
  })
  promise
      .then(()=&gt;console.log("PROMISE"))          // #2
      .catch((err) =&gt; console.log(err))
  
  console.log("SIMPLE CONSOLE LOG");             // #3
  </code></pre>
  
  <p>OutPut : </p>
  
  <pre><code>SIMPLE CONSOLE LOG
  PROMISE
  SET TIME OUT
  </code></pre>