Answers for "find duplicate objects in array js"

0

find duplicate objects in array js

let arr = []
arr.push({place:"here",name:"stuff"});
arr.push({place:"there",name:"morestuff"});
arr.push({place:"there",name:"morestuff"});


arr = arr.filter((value, index, self) =>
// return if the index if the matched innerr iteration matches the index of the outer iterator
  index === self.findIndex((t) => (
    t.place === value.place && t.name === value.name
  ))
)
Posted by: Guest on April-20-2022
0

find duplicate objects in array js

let arr = []
arr.push({place:"here",name:"stuff"});
arr.push({place:"there",name:"morestuff"});
arr.push({place:"there",name:"morestuff"});


arr = arr.filter((value, index, self) =>
                 // return if the index if the matched innerr iteration matches the index of the outer iterator
  index === self.findIndex((t) => (
    t.place === value.place && t.name === value.name
  ))
)
Posted by: Guest on April-20-2022

Code answers related to "find duplicate objects in array js"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language