I have array. Every element in this array is object, that contains also array. So I need to get sum of every items in array, that exists in array.
I have tried next :
function getSum(total, item) {
return total + item;
}
var sum = array.reduce((total, item) => total + item.data.reduce(getSum));
But It returns not sum, but string, which starts with Object...
array.