August 10th, 2024
What's missing in this code?
// Get the sum of the product of the arrays element by element!
// sumOfProduct([2, 5], [10, 7]) -> 55
// sumOfProduct([1, 4, 7], [3, 1, 5]) -> 42
function sumOfProduct(arr1, arr2)
const result = [];
for (let i = 0; i < arr1.
; i++)
result.
(arr1[i]
arr2[i]);
}
return result.
((sum, num) => sum + num, 0);
}
Type or select from these options