I’m trying to find the sum total of the arrays nested inside of the parent array. and push the sums into their own array. only using the for loop.
I could be way off here, I can’t seem to get past how to find the sum of the second array i know how to find the sum of just one, but when another is thrown into the mix it gets a little dicy and starts flagging errors. any suggestions or thought exercises are more than welcome!
let array = [1,3,3,5,6],[1,3,6,5,6];
let sum = 0;
let newArray = []
for(let i = 0; i < array.length; i++){
sum+=array[i]
newArray.push(sum)
}
console.log (newArray)