title: Filter unique values from an array of objects
body: <p>How can I use Array.filter() to return unique <code>id</code> with <code>name</code> ?</p>
  
  <p>My scenario is slightly different than the solutions I have researched in that I have an array of objects. Every example I find contains a flat array of single values.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>data=[
  {id: 555, name: "Sales", person: "Jordan" },
  {id: 555, name: "Sales", person: "Bob" },
  {id: 555, name: "Sales", person: "John" },
  {id: 777, name: "Accounts Payable", person: "Rhoda" },
  {id: 777, name: "Accounts Payable", person: "Harry" },
  {id: 888, name: "IT", person: "Joe" },
  {id: 888, name: "IT", person: "Jake" },
  ];</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var unique = data.filter(
  function (x, i) {
     return data[i].id.indexOf(x.id) === i
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks in advance.</p>