title: Return when .each is completed
body: <pre><code>Promise.try(function (){
      return Promise.all(splitup); // [Show, me, stocks, for, Google, and, Microsoft]
  }).each(function (item) { // Looping through entities, [Show] [me] [stocks] ...
      alchemyapi.entities('text', item, { 'sentiment' : 1}, function (response) {
          if(response.entities) { // An entity is found, ex. Microsoft
              if(response.entities[0].type === "Company") {
                  requestBody.push(item);
                  console.log("Item was found, added " + item);
              } else {
                  console.log(item + " Is not a company");
              }
          } else { // no entity found for that one word
              console.log("No entity found for " + item);
          }
      });
  }).then(function (response) {
      // send requestBody when loop is completed.
  });
  </code></pre>
  
  <p>I start by returning an array of strings <code>splitup</code> so I can loop through each element on <code>line 3</code>. </p>
  
  <p>Let's say the <code>splitup</code> array looks like: [<code>Apple</code>, <code>And</code>, <code>Mexico</code>]</p>
  
  <p><code>Apple</code> is a company, so <code>if(response.entities)</code> returns true, it then checks the JSON response to see if it is a company, that statement returns <code>true</code> and It's added to the new <code>requestBody</code> array I'm building up.</p>
  
  <p>Next, the word <code>'And'</code> returns false on <code>if(response.entities)</code> so It goes to the else statement.</p>
  
  <p>Next, let's pick <code>Mexico</code>, It'll return true for <code>if(response.entities)</code> but return false on <code>if(response.entities[0].type === "Company")</code></p>
  
  <p>My question is, I'd like to return the new requestBody array when It has completed looping through each item, but I'm not entirely sure how I can tell when the loop is completed, and when to return <code>requestBody</code></p>