Answers for "filter out some elemnt from array of object with another array of object without duplicate"

-1

remove duplicate object from array javascript

let uniqIds = {}, source = [{id:'a'},{id:'b'},{id:'c'},{id:'b'},{id:'a'},{id:'d'}];
let filtered = source.filter(obj => !uniqIds[obj.id] && (uniqIds[obj.id] = true));
console.log(filtered);
// EXPECTED: [{id:'a'},{id:'b'},{id:'c'},{id:'d'}];
Posted by: Guest on August-04-2021

Code answers related to "filter out some elemnt from array of object with another array of object without duplicate"

Code answers related to "Javascript"

Browse Popular Code Answers by Language