As stated above, how do I sum & group object data?
I try to use forEach & Object.key() to group data.
But I'm not too familiar with it.
This is my example data :
const srcArr =[
{
"1" : {
"60" : {
"point" : 10,
"count" : 1
},
"68" : {
"point" : 20,
"count" : 1
},
}
},
{
"2" : {
"60" : {
"point" : 100,
"count" : 2
}
}
},
{
"1" : {
"88" : {
"point" : 50,
"count" : 1
},
"68" : {
"point" : 20,
"count" : 1
},
}
},
I want data like this :
{
'1': { '60': { money: 10, count: 1 },
'68': { money: 40, count: 2 },
'88': { money: 50, count: 1 }},
'2': { '60': { money: 100, count: 2 }}
}