From 978b058914c74f273da61110b64c64137b4237bf Mon Sep 17 00:00:00 2001 From: UdhavKumar <61343874+UdhavKumar@users.noreply.github.com> Date: Thu, 1 Oct 2020 18:27:22 +0530 Subject: [PATCH 1/2] Update AverageMean.js --- Maths/AverageMean.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/AverageMean.js b/Maths/AverageMean.js index d0dc833c54..bf9f5a0dd4 100644 --- a/Maths/AverageMean.js +++ b/Maths/AverageMean.js @@ -11,7 +11,7 @@ https://en.wikipedia.org/wiki/Mean */ -function mean (nums) { +function mean (nums) { // This is a function named mean whitch nums in the parentheses 'use strict' var sum = 0 var avg From 26b15c38b96224b23b5e83e001d5d73ba9cf305f Mon Sep 17 00:00:00 2001 From: vinayak Date: Thu, 1 Oct 2020 23:31:31 +0530 Subject: [PATCH 2/2] Update AverageMean.js --- Maths/AverageMean.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Maths/AverageMean.js b/Maths/AverageMean.js index bf9f5a0dd4..28f96d53ef 100644 --- a/Maths/AverageMean.js +++ b/Maths/AverageMean.js @@ -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) { // This is a function named mean whitch nums in the parentheses - '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 })