title: Using lodash to compare and remove an object from an array
body: <p>I'm trying to use lodash to compare two arrays of objects and return the difference between the two, then adding it to the original data set. Reason being, the new data will contain the same data from the original. For example, I have 3 objects in <code>orgData</code>, and when I request <code>newData</code>, it will contain the same <code>orgData</code> plus one more object.</p>
  
  <pre><code>var orgData = [{
    "id": 1000,
    "title": "First item"
  }, {
    "id": 1001,
    "title": "Second item"
  }];
  
  var newData = [{
    "id": 1000,
    "title": "First item"
  }, {
    "id": 1001,
    "title": "Second item"
  }, {
    "id": 1002,
    "title": "Third item"
  }];
  </code></pre>
  
  <p>My only delimiter in comparing is the <code>id</code> which is unique. I've tried the following, but the error I receive is 'Cannot read property of 'id' undefined' which makes sense.</p>
  
  <pre><code>_.filter(orgData, function(o, x) {
    return o.id !== newData[x].id;
  }).forEach(function(x) {
    orgData.push(x);
  });
  </code></pre>