Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

A.reduce

const arr = [3, 5, 4, 11, 7, 22];

arr.reduce((previousValue, currentValue) => {
    return previousValue + currentValue;  // <--- 3 + 5 + 4 + 11 + 7 + 22 = 52
}, 0) 
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
5+8 =