title: Error calling forEach on array
body: <p>I am getting a problem forEach within anoter forEach function:</p>
  
  <p>The <code>results</code> variable contains an object like:</p>
  
  <pre><code>{
      names: [
          'Someone',
          'Someone else'
      ],
      emails: [
          'someone@someemail.com'
          'something@somemail.com'
      ]
  }
  </code></pre>
  
  <p>I want it to unwind all the arrays and result in an array like this:</p>
  
  <pre><code>[
      {term: 'Someone', type: 'names'},
      ...
  ]
  </code></pre>
  
  <p>Here is my code: </p>
  
  <pre><code>var keys = _.keys(results);
  
  console.log(keys);
  
  var finalResult = [];
  
  keys.forEach( function (key) {
  
      var arrTerms = results[key];
  
      console.log(key, arrTerms); //arrTerms prints fine
  
      arrTerms.forEach(function (term) { //This line throws an exception
  
          finalResult.push({
              term: term,
              type: key
          });
      });
  
  });
  </code></pre>
  
  <p>The nested call to forEach throws the following exception:</p>
  
  <pre><code>TypeError: Uncaught error: Cannot call method 'forEach' of undefined
  </code></pre>
  
  <p>I tried using a for loop with iteration till length, but it generated another exception:</p>
  
  <pre><code>TypeError: Uncaught error: Cannot read property 'length' of undefined
  </code></pre>