Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sum of an array

const sum = (...args) => args.reduce((a, b) => a + b, 0);
console.log(sum(1,2,3)); // returns 6
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #sum #array
ADD COMMENT
Topic
Name
8+1 =