Answers for "object remove duplicates"

-1

remove duplicates from array of objects javascript

let arr = [{name: "john"}, {name: "jane"}, {name: "imelda"}, {name: "john"}];

const uniqueArray = arr.filter((v,i,a)=>a.findIndex(t=>(t.name===v.name))===i)
console.log(uniqueArray);
Posted by: Guest on June-21-2021
0

remove duplicate object from array javascript

const uniqify = (array, key) => array.reduce((prev, curr) => prev.find(a => a[key] === curr[key]) ? prev : prev.push(curr) && prev, []);
Posted by: Guest on August-04-2021

Code answers related to "object remove duplicates"

Code answers related to "Javascript"

Browse Popular Code Answers by Language