Currenly using Angular with lodash to do some additional usability but currently hitting a roadblock.
I have the following arrays:
{
"Result": [
{
"Name": "marketeerBoston",
"Label": "Week25",
"Total": 251200,
"Specific": [
{
"Label": "3",
"Value": 25,
},
{
"Label": "4",
"Value": 250,
}
]
},
{
"Name": "marketeerJersey",
"Label": "Week25",
"Total": 776090,
"Specific": [
{
"Label": "1",
"Value": 32,
},
{
"Label": "2",
"Value": 37,
}
]
},
],
}
I really need to have the Value summed up from both array objects (so I got 344).
How to achieve that with lodash?
const valueTotal = object.Result.reduce(reducer, 0), where the reducer is something like(runningTally, currentArrayElement) => getTotalValueFrom(currentArrayElement), and I'm sure you know how to implementfunction getTotalValueFrom(entry).