title: Getting difference between 2 arrays of objects in JavaScript
body: <p>I have searched a lot on internet and I thought this would be a really simple task but I have not found any solution for this </p>
  
  <p>These are my two array of objects </p>
  
  <p>First array</p>
  
  <pre><code>[ 
    { id: 2, fees: 10000, name: 'Yearly Plan', cycle: 12 },
    { id: 3, fees: 1500, name: 'Two Months Plan', cycle: 2 },
    { id: 4, fees: 2500, name: 'Three Months Plan', cycle: 3 },
    { id: 5, fees: 3000, name: 'Four Months Plan', cycle: 4 },
    { id: 181, fees: 4000, name: 'Five Months Plan', cycle: 5 },
    { id: 182, fees: 5000, name: 'Six Months Plan', cycle: 6 },
    { id: 183, fees: 6000, name: 'Seven Months Plan', cycle: 7 } 
  ] 
  </code></pre>
  
  <p>Second array</p>
  
  <pre><code>[ 
    { id: 2, fees: 10000, name: 'Yearly Plan', cycle: 12 },
    { id: 3, fees: 1500, name: 'Two Months Plan', cycle: 2 },
    { id: 4, fees: 2500, name: 'Three Months Plan', cycle: 3 } 
  ]
  </code></pre>
  
  <p>I want to get difference between two array of Objects and I want result something like this </p>
  
  <p>First array - Second array = ( array of objects which are there in first array but not there in second array )</p>
  
  <pre><code>[ { id: 5, fees: 3000, name: 'Four Months Plan', cycle: 4 },
    { id: 181, fees: 4000, name: 'Five Months Plan', cycle: 5 },
    { id: 182, fees: 5000, name: 'Six Months Plan', cycle: 6 },
    { id: 183, fees: 6000, name: 'Seven Months Plan', cycle: 7 } ]
  </code></pre>
  
  <p>I have tried many many methods like filter like this </p>
  
  <pre><code>     let c = existingBillPlans.filter(item =&gt; 
  !billPlans.some(other =&gt; item.x == other.x));
  </code></pre>
  
  <p>but it is giving null array . Not able to understand what I should do .</p>