We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b9b73c commit 91b5072Copy full SHA for 91b5072
1 file changed
Maths/AverageMean.js
@@ -1,3 +1,4 @@
1
+'use strict'
2
/*
3
author: PatOnTheBack
4
license: GPL-3.0 or later
@@ -11,12 +12,12 @@
11
12
https://en.wikipedia.org/wiki/Mean
13
*/
14
-function mean (nums) {
15
- 'use strict'
+const mean = (nums) => {
16
+ // This is a function returns average/mean of array
17
var sum = 0
18
var avg
19
- // This loop sums all values in the 'nums' array.
20
+ // This loop sums all values in the 'nums' array using forEach loop
21
nums.forEach(function (current) {
22
sum += current
23
})
0 commit comments