Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find duplicate item in array of object in javascript

const values = [
  { name: 'someName1' },
  { name: 'someName2' },
  { name: 'someName3' },
  { name: 'someName1' }
]

const uniqueValues = new Set(values.map(v => v.name));

if (uniqueValues.size < values.length) {
  console.log('uniqueValues')
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #duplicate #item #array #object #javascript
ADD COMMENT
Topic
Name
8+9 =