title: Array filling up with Pending Promises?
body: <p>I am so close to finishing the base of this function but i am stuck, and its a little todo with my lack of knowledge in promises and i am learning how they function etc. Regarding my issue, i am looping through some data that is then being stored in an Array that will be passed to another function via promise chain, however the array is being filled with pending promises where i just need the actual data from the promise placed into the array, please see below to understand whats going on:</p>
  
  <pre><code>var getGameData = function(matchIdArray) {
  var promise = new Promise(function(resolve,reject) {
    console.log('Start getGameData');
    s3.headObject({Bucket: 'lolsearchgames', Key: '347341'}, function(err, result) {
      console.log('Checking Bucket');
      if (err &amp;&amp; err.code === 'NotFound') {
        console.log('Bucket data Not Found!')
        var gameData = new Array();
        for (var i = 0; i &lt; matchIdArray.length; i++) {
          gameData.push(new Promise(function(res, rej) {
            lolapi.Match.get(matchIdArray[i], function (error, gamedata) {
              if (error) {
                  rej(error);
              }
              if (gamedata) {
                  console.log('Pushing new data to Array! ' + gamedata.matchId);
                  res(gamedata);
              }
            })
          }));
        }
        if (gameData.length === 10) {
            console.log(gameData);
            resolve(gameData);
        }
      } else {
        console.log('Bucket data Found!');
      }
    })
  });
  return promise;
  console.log('End getGameData');
  };
  </code></pre>