title: Wait on all promises in a promise chain
body: <p>Is there a way to wait on all promises in a Promise chain? I have discovered the Promise.all() function for waiting on an array of promises, but I couldnt make that work.</p>
  
  <p>I have something that is roughly like this</p>
  
  <pre><code>var returnPromise2;
  var returnPromise1 = function1ThatReturnsAPromise.then(
      function onSuccess(array) {
         console.log("First function finished");
      }).then( function (value) {
            returnPromise2 = function2ThatReturnsAPromise(value);
      });
      return [returnPromise1, returnPromise2];
  </code></pre>
  
  <p>So in my calling code, if i do <code>Promise.all(arrayOfPromises)</code> I am able to get the value from returnPromise1, but not the 2nd one. The dillema being that at the time of the return, <code>returnPromise2</code> is still null.</p>
  
  <p>Any tips appreciated on how to approach this.</p>