Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript average function

const arr = [5,10,15,20,25];
        arr.reduce(function(x,y){
            sum = x+y;
            mean = sum/arr.length;
            return sum;
        },
        0);
         console.log(mean);//15
Source by www.codecheef.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #average #function
ADD COMMENT
Topic
Name
2+9 =