i have a collection with some of duplicate objects , i want filter array and get unique collection this is my array
array=[{id:1,name:'A'},{id:2,name:'B'},{id:3,name:'C'},{id:1,name:'A'},{id:3,name:'C'}];
i want to filter like below
array=[{id:1,name:'A'},{id:2,name:'B'},{id:3,name:'C'}];
var unique = [];
for(let i = 0; i< this.array.length; i++){
if(unique.indexOf(this.array[i].id) === -1){
unique.push(this.array[i].id);
}
}
i tried above and am getting unique values but i want complete object