In my code i have created one array called array1. In this array i have listed multiple objects. I want to filter out array1 objects values as unique and need to group ids with their respective values. I have added my code here,
Array1
var array1 = [
{
value:"A",
id:1
},
{
value:"B",
id:1
},
{
value:"C",
id:2
},
{
value:"B",
id:5
},
{
value:"A",
id:2
},
{
value:"A",
id:1
}
];
the result which i want,
[
{
group:"A",
groupIds:[1, 2]
},
{
group:"B",
groupIds:[1, 5]
},
{
group:"C",
groupIds:[2]
}
]