DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
8+1 =
Submit