Skip to content

Commit 252ff10

Browse files
author
Hridyanshu7
committed
fix: optimized AverageMean.js by removing redundant comments and unnecessary operations.
1 parent 1276daa commit 252ff10

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Diff for: Maths/AverageMean.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ const mean = (nums) => {
1313
throw new TypeError('Invalid Input')
1414
}
1515

16-
// This calculates the sum of all values in the 'nums' array using reduce method.
17-
const sum = nums.reduce((sum, cur) => sum + cur, 0)
18-
19-
// Divide sum by the length of the 'nums' array.
20-
return sum / nums.length
16+
return nums.reduce((sum, cur) => sum + cur / nums.length, 0)
2117
}
2218

2319
export { mean }

0 commit comments

Comments
 (0)