title: Node JS changing output randomly
body: <p>Environment :- NodeJS 14.15.0</p>
  <p>In the Following Code :-</p>
  <pre><code>const sleep_st = (t) =&gt; new Promise((r) =&gt; setTimeout(r, t));
  const sleep_im = () =&gt; new Promise((r) =&gt; setImmediate(r));
  
  (async () =&gt; {
      setImmediate(() =&gt; console.log(1));
      console.log(2);
      
  
      await sleep_st(0);
      
      setImmediate(() =&gt; console.log(3));
      console.log(4);
  
      await sleep_im();
      setImmediate(() =&gt; console.log(5));
  
      console.log(6);
  
      await 1;
  
      setImmediate(() =&gt; console.log(7));
      console.log(8);
  })();
  </code></pre>
  <p>Some time the output is :-
  2 1 4 3 6 8 5 7</p>
  <p>But Sometimes :-
  2 4 1 3 6 8 5 7</p>