mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Improved Documentation (#329)
* Update AverageMean.js * Update AverageMean.js Co-authored-by: vinayak <itssvinayak@gmail.com>
This commit is contained in:
@ -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
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user