I want to sum each value of an array of numbers with its corresponding value in a different array of numbers, and I want to do this without looping through each individual v
Another way to do it could be like that
var array1 = [1,2,3,4]; var array2 = [5,6,7,8]; var sum = [...array1].map((e,i)=> e+array2[i]); //[6,8,10,12]
In this case [...array1] is the same to [1,2,3,4]
[...array1]
[1,2,3,4]