Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript: reduce function, mean/average


function mean2(numbers) {
    const total = numbers.reduce(function(sum, number) {
        return sum + number;
    });
    return total / numbers.length;
}
Source by jrsinclair.com #
 
PREVIOUS NEXT
Tagged: #reduce
ADD COMMENT
Topic
Name
7+7 =