title: check the difference between two arrays of objects in javascript
body: <p>I need some help. How can I get the array of the difference on this scenario:</p>
  
  <pre><code>var b1 = [
    { id: 0, name: 'john' }, 
    { id: 1, name: 'mary' }, 
    { id: 2, name: 'pablo' }, 
    { id: 3, name: 'escobar' } 
  ]; 
  
  var b2 = [
    { id: 0, name: 'john' }, 
    { id: 1, name: 'mary' }
  ];
  </code></pre>
  
  <p>I want the array of difference:</p>
  
  <pre><code>// [{ id: 2, name: 'pablo' }, { id: 3, name: 'escobar' }]
  </code></pre>
  
  <p>How is the most optimized approach?</p>
  
  <p>I´m trying to filter a reduced array.. something on this line:</p>
  
  <pre><code>var Bfiltered = b1.filter(function (x) {
  return x.name !== b2.reduce(function (acc, document, index) {
      return (document.name === x.name) ? document.name : false
  },0)
  </code></pre>
  
  <p>});</p>
  
  <pre><code>console.log("Bfiltered", Bfiltered);
  // returns { id: 0, name: 'john' }, { id: 2, name: 'pablo' }, { id: 3, name: 'escobar' } ]
  </code></pre>
  
  <p>Thanks, </p>
  
  <p>Robot</p>