I have data like this:
data = [
[{a: "b", value: 12}, {a: "bb", value: 39}, {a: "bb", value: 150}],
[{a: "c", value: 15}, {a: "cc", value: 83}, {a: "ccc", value: 12}],
[{a: "d", value: 55}, {a: "dd", value: 9}, {a: "dd", value: 1}]
]
I want to add each value in each array with same index, so the result would be like this:
[82, 131, 163]
so I tried to loop through data and get each array. then loop through each array again to get each object like this:
for(let i = 0; i < data.length; i++) {
let eachArr = data[i]
for(let j = 0; j < eachArr.length; j++){
console.log(eachArr[j]);
}
}
I am not sure how to add each value with same index and push it to new array