title: Invoking an array of functions asynchronously
body: <p>I would like to invoke an array of functions asynchronously so that only once func1 has resolved, will func2 be invoked.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myAsyncFunction(url) {
    return new Promise((resolve, reject) =&gt; {
      const xhr = new XMLHttpRequest();
      xhr.open("GET", url);
      xhr.onload = () =&gt; resolve(xhr.responseText);
      xhr.onerror = () =&gt; reject(xhr.statusText);
      xhr.send();
    });
  }
  
  const func1 = () =&gt; myAsyncFunction('a');
  const func2 = () =&gt; myAsyncFunction('b');
  const func3 = () =&gt; myAsyncFunction('c');
  
  function asychFunctions(arguments) {
    arguments.forEach(func =&gt; {
      func();
    });
  }
  
  asychFunctions([func1, func2, func3])</code></pre>
  </div>
  </div>
  </p>