mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +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
|
||||
license: GPL-3.0 or later
|
||||
@ -11,12 +12,12 @@
|
||||
https://en.wikipedia.org/wiki/Mean
|
||||
*/
|
||||
|
||||
function mean (nums) {
|
||||
'use strict'
|
||||
const mean = (nums) => {
|
||||
// This is a function returns average/mean of array
|
||||
var sum = 0
|
||||
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) {
|
||||
sum += current
|
||||
})
|
||||
|
Reference in New Issue
Block a user