Answers for "js array of obj get same value"

2

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')
}
Posted by: Guest on December-10-2020
4

find a single element in array of objects javascript

myArray.find(x => x.id === '45').foo;
Posted by: Guest on May-25-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language