title: How is async/await working in serial and parallel?
body: <p>I have two <code>async</code> functions. Both of them are waiting for two 3 seconds function calls. But the second one is faster than the first. I think the faster one is running in parallel and other in serial. Is my assumption correct? If yes, why is this happening as both the functions look logically same?</p>
  
  <pre><code>function sleep() {
    return new Promise(resolve =&gt; {
      setTimeout(resolve, 3000);
    });
  }
  
  async function serial() {
    await sleep();
    await sleep();
  }
  
  async function parallel() {
    var a = sleep();
    var b = sleep();
    await a;
    await b;
  }
  
  serial().then(() =&gt; {
    console.log("6 seconds over");
  });
  
  parallel().then(() =&gt; {
    console.log("3 seconds over");
  });
  </code></pre>