title: How to get duplicates in a JavaScript Array using Underscore
body: <p>I have an array for which I need to the items that are duplicates and print the items based on a specific property. I know how to get the unique items using underscore.js but I need to find the duplicates instead of the unique values</p>
  
  <pre><code>var somevalue=[{name:"john",country:"spain"},{name:"jane",country:"spain"},{name:"john",country:"italy"},{name:"marry",country:"spain"}]
  
  
  var uniqueList = _.uniq(somevalue, function (item) {
          return item.name;
      })
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>[{name:"jane",country:"spain"},{name:"marry",country:"spain"}] 
  </code></pre>
  
  <p>but I actually need the opposite</p>
  
  <pre><code>[{name:"john",country:"spain"},{name:"john",country:"italy"}]
  </code></pre>