Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get sum array in javascript

let sum1 = (arr) => arr.reduce( (x,y) => x+y);

console.log(sum1([2, 4, 9]));
console.log(sum1([15, 200, 18, 0, 18, 18]));
console.log(sum1([100, 4, 17, 29, 81]));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #array #javascript
ADD COMMENT
Topic
Name
1+4 =