Suppose I have an array of arrays structured as follows:
[
[0, 1, 3],
[2, 4, 6],
[5, 5, 7],
[10, 0, 3]
]
Is there a way to create a new array that calculates the sum of all values at each index position within the inner arrays using JavaScript? For the given example, the result would be: [17, 10, 19]. I need a solution that will work regardless of the length of the inner arrays. I believe it may involve a combination of map and for-of loops, or maybe reduce method, but I am struggling to understand the implementation. Despite my search efforts, I have not found any examples that precisely match this scenario.