Improved Documentation (#329)

* Update AverageMean.js

* Update AverageMean.js

Co-authored-by: vinayak <itssvinayak@gmail.com>
This commit is contained in:
UdhavKumar
2020-10-04 19:19:44 +05:30
committed by GitHub
parent 1b9b73c3ee
commit 91b5072d2b

View File

@ -1,3 +1,4 @@
'use strict'
/* /*
author: PatOnTheBack author: PatOnTheBack
license: GPL-3.0 or later license: GPL-3.0 or later
@ -11,12 +12,12 @@
https://en.wikipedia.org/wiki/Mean https://en.wikipedia.org/wiki/Mean
*/ */
function mean (nums) { const mean = (nums) => {
'use strict' // This is a function returns average/mean of array
var sum = 0 var sum = 0
var avg var avg
// This loop sums all values in the 'nums' array. // This loop sums all values in the 'nums' array using forEach loop
nums.forEach(function (current) { nums.forEach(function (current) {
sum += current sum += current
}) })