I am a beginner in Javascript. I did some research and still cannot figure out how to return the sum of array1 and add it to each number in array2. My code adds the sum of both arrays instead. I want the expected log to be [11, 13, 15]
function addingAllTheWeirdStuff(array1, array2){
let list = []
let sum = 0
for (let i = 0; i < Math.max(array1.length, array2.length); i++){
list.push(sum += array1[i])
sum += array2[i]
} return sum
}
console.log(addingAllTheWeirdStuff([1, 3, 5], [2, 4, 6])); // expected log [11, 13, 15]