title: Difference between Promise.all and running Promises serially?
body: <p>Say I have a bunch of promises.</p>
  
  <pre><code>const promises = [ /*...*/ ];
  </code></pre>
  
  <p>And I want something to happen when all the promises have resolved. What's the difference between the following two ways of doing this:</p>
  
  <ol>
  <li><p>Using <code>Promise.all</code></p>
  
  <pre><code>const allDonePromise = Promise.all(promises);
  </code></pre></li>
  <li><p>Running the promises serially</p>
  
  <pre><code>async function allPromises(promisesArray) {
    const results = [];
  
    for (const promise of promisesArray) {
      results.push(await promise);
    }
  
    return results;
  }
  
  const allDonePromises = allPromises(promises);
  </code></pre></li>
  </ol>
  
  <p>Is <code>Promise.all</code> just a builtin which does what <code>allPromises</code> does or is there something else happening under the hood to make Promise.all faster. Where can I find information about the internals of <code>Promise.all</code>?</p>