Answer the question
In order to leave comments, you need to log in
Is it possible to display the sum of the elements of two arrays in one action?
function sumTwoArrays(arr1, arr2) {
let sum1 = arr1.reduce((sum, cur) => sum + cur);
let sum2 = arr2.reduce((sum, cur) => sum + cur);
return sum1 + sum2;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question