remove duplicate array parsing javascript code example
Example 1: how to remove duplicate array object in javascript
let person = [
{name: "john"},
{name: "jane"},
{name: "imelda"},
{name: "john"},
{name: "jane"}
];
const obj = [...new Map(person.map(item => [JSON.stringify(item), item])).values()];
console.log(obj);
Example 2: remove duplicates from array of objects javascript
arr.filter((v,i,a)=>a.findIndex(t=>(t.place === v.place && t.name===v.name))===i)