I would like to filter the following arrays
[
{
index: 4,
name: "car",
price: [10,20,30]
},
{
index: 4,
name: "car",
price: [40,50,60]
},
{
index: 3,
name: "bike",
price: [40,50,60]
},
{
index: 2,
name: "scooter",
price: [10,20,60]
},
{
index: 2,
name: "scooter",
price: [70]
},
]
so that the output looks like this
[
{
index: 4,
name: car,
price: [40,50,60,10,20,30]
},
{
index: 3,
name: bike,
price: [40,50,60]
},
{
index: 2,
name: scooter,
price: [10,20,60, 70]
}
]
Objects that have the same name and index, connect, i.e. connect the price array.
I can filter this array but I don't know how to connect price array. Code in codesanbox