title: Building an array of promises for Promise.all() on the fly
body: <p>so I've been trying to use the <code>Promise.all()</code> method and I'm running into an issue where I need to pass the method an array of promises, but I'm not sure how many promises are going to be called for/needed by the application.</p>
  
  <p>Here's a method that I've gotten working by specifically building the array </p>
  
  <pre><code>router.post('/test1', (req, res, next) =&gt; {
      console.log('Hit on POST /test1');
      let arr = ['email1@email.com','email2@email.com'];
      Promise.all([
        lookUpUserId(arr[0]),
        lookUpUserId(arr[1])
      ]).then((x)=&gt;{res.send(x)});
  });
  </code></pre>
  
  <p>My <code>lookUpUserId()</code> function is returning a promise and I'm able to use it if I explicitly list them in the array. However I've tried a few methods of creating this array on the fly and I can't seem to get it working.<br>
  Example #1</p>
  
  <pre><code>router.post('/test1', (req,res,next) =&gt; {
      console.log('Hit on POST /test1');
      let arr = ['email1@email.com','email2@email.com'];
      Promise.all((arr)=&gt;{
        let out = [];
        for(let i=0; i&lt;arr.length; i++){
          out.push(lookUpUserId(arr[i]));
        }
        return out;
      }).then((x)=&gt;{res.send(x)});
  });
  </code></pre>
  
  <p>Example 2</p>
  
  <pre><code>outer.post('/test1', (req,res,next) =&gt; {
      console.log('Hit on POST /test1');
      let arr = ['email1@email.com','email2@email.com'];
      let promArr = (arr)=&gt;{
        let out = [];
        for(let i=0; i&lt;arr.length; i++){
          out.push(lookUpUserId(arr[i]));
        }
      }
      Promise.all(promArr).then((x)=&gt;{res.send(x)});
  });
  </code></pre>