find duplicate objects in array js find duplicate objects in array js

The solution for “find duplicate objects in array js find duplicate objects in array js” can be found here. The following code will assist you in solving the problem.

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
))
)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
))
)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in