Having trouble adding together 4 nested arrays in JavaScript. The arrays are structured like this: x = [[Array1(9)], [Array2(9)], [Array3(9)], [Array4(9)]]
I am looking to "zip" them together and add the values. For example, I want to add Array1[0] with corresponding elements of Array2-4[0], and do this for all nine values in each array.
The arrays look like this:
[1, 2, 4, 3.6, 1.05, 4.65, 1.95, 0.5, 2.5]
[0.432, 0.602, 1.29, 1.146, 0.558, 1.43, 0.686, 0.178, 1.024]
The result would be something like:
[1.432, 2.602, etc...]
I've been struggling with using x.map() to accomplish this. Any assistance would be greatly appreciated.
Thank you,