0

i'd like to get a solution for this question ::Write a function called sumArrays that takes an array of arrays as a parameter,

function sumArrays(array){ var sum=0; for (let i = 0; i < array.length; i++) { sum=sum+array[i]; } return sum; }

6th Apr 2024, 12:45 AM
WINGZ H
WINGZ H - avatar
2 Respostas
+ 1
A structure of an array of arrays looks something like this. [ [1, 2, 3], [11, 12, 13, 14], [21, 22, 23, 24, 25], ] If you want to get a total of all the arrays (171), you need a nested loop to iterate over all the arrays. The outer loop is for the individual array, and the inner loop is for the elements inside that individual array.
6th Apr 2024, 2:18 AM
Wong Hei Ming
Wong Hei Ming - avatar
0
okay tysm for help
6th Apr 2024, 2:33 AM
WINGZ H
WINGZ H - avatar