Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sum of array

[1, 2, 3, 4].reduce((a, b) => a + b, 0)

// Output: 10
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #sum #array
ADD COMMENT
Topic
Name
5+2 =