I have two arrays of equal length, and I need to multiply the corresponding (by index) values in each, and sum the results.
For example
var arr1 = [2,3,4,5];
var arr2 = [4,3,3,1];
would result in 34 (4*2+3*3+4*3+5*1).
What’s the simplest to read way to write this?
1 Answer