suppose onw array has object like below
enter code here [
{
"id": 0,
"value": "carding",
"name": "PAUL JOSEPH SCARSI"
},
{
"id": 1,
"value": "carding",
"name": "ARLIE CHRIS NOLLMAN"
}
]
output:
[value: carding, name: ['paul', 'jhon']]
const ObjArr = [{id: 0, value: 'carding', name: 'paul'}, {id: 1, value: 'carding', name: 'jhon'}]
const uniqueValues = []
const uniqueObjArr = ObjArr.filter(element => {
const isDuplicate = uniqueValues.includes(element.value);
if (!isDuplicate) {
uniqueValues.push(element.value);
return true;
}
return false;
});