I have a JS Array which also contains arrays with each holding a bunch of objects structured like below.
const arr1 = [
[{symbol: "xy", balance: 2155113}, {symbol: "asda", balance: 21231231}],
[{symbol: "asda", balance: 6543}, {symbol: "xy", balance: 21678}]
]
What I need, is an output array, that groups all the child arrays by the "symbol" property and adds (+) the balances together.
At the End I want to have an array like this
[
{symbol: xy, summedBalance: 213131313},
{symbol: yz, summedBalance: 6788767867},
]
Is this possible with normal javascript or maybe a module like lodash?