remove duplicates in array object javascript
//check one attribute
let person = [{name: "john"}, {name: "jane"}, {name: "imelda"}, {name: "john"}];
person = person.filter((item, index, self) =>
index === self.findIndex((t) => (
t.name === item.name
))
)
//check two attributes
let person = [{place: "uno", name: "john"}, {place: "duno", name: "jane"}, {place: "duno" ,name: "imelda"}, {place: "uno" ,name: "john"}];
person = person.filter((item, index, self) =>
index === self.findIndex((t) => (
t.place === item.place && t.name === item.name
))
)