Collect unique objects in JavaScript array
<p>Suppose I have following arrays of objects</p>

<pre><code>var firstDataSet = [
  {'id': 123, 'name': 'ABC'},
  {'id': 456, 'name': 'DEF'},
  {'id': 789, 'name': 'GHI'},
  {'id': 101, 'name': 'JKL'}
];

var secondDataSet = [
  {'id': 123, 'name': 'ABC', 'xProp': '1q'},
  {'id': 156, 'name': 'MNO', 'xProp': '2w'},
  {'id': 789, 'name': 'GHI', 'xProp': '3e'},
  {'id': 111, 'name': 'PQR', 'xProp': '4r'}
];
</code></pre>

<p>Now I want to collect array with unique objects (matching <code>id</code> and <code>name</code>)i.e.</p>

<pre><code>var firstDataSet = [
  {'id': 123, 'name': 'ABC', 'xProp': '1q'},
  {'id': 456, 'name': 'DEF'},
  {'id': 789, 'name': 'GHI', 'xProp': '3e'},
  {'id': 101, 'name': 'JKL'},
  {'id': 156, 'name': 'MNO', 'xProp': '2w'},
  {'id': 111, 'name': 'PQR', 'xProp': '4r'}
];
</code></pre>

<p>I am able to collect ALL with </p>

<pre><code>Array.prototype.unshift.apply(firstDataSet , secondDataSet );
</code></pre>

<p>But not sure how I can filter out duplicates. Any suggestion?</p>

<p>Edit: My object on two different array are not same. At least based on number of properties.</p>