Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js reduce

Sum array elements:
let myArr = [1,2,3,-1,-34,0]
return myArr.reduce((a,b) => a + b,0)
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #js #reduce
ADD COMMENT
Topic
Name
4+4 =