I am working with an array where each element is an object that also contains an array. My goal is to calculate the sum of all items in the nested arrays.
Here is the approach I have attempted:
function getSum(total, item) {
return total + item;
}
var sum = array.reduce((total, item) => total + item.data.reduce(getSum));
However, instead of getting the sum, I am seeing a string that starts with Object
...