Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55ff0ad

Browse files
HRIDYANSHU054Hridyanshu7appgurueu
authored
docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js (#1727)
* docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js* fix: optimized AverageMean.js by removing redundant comments and unnecessary operations.* Update Maths/AverageMean.jsCo-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>---------Co-authored-by: Hridyanshu7 <himank7794@gmail.com>Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
1 parentff314a2 commit55ff0ad

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

‎Maths/AverageMean.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ const mean = (nums) => {
1313
thrownewTypeError('Invalid Input')
1414
}
1515

16-
// This loop sums all values in the 'nums' array using forEach loop
17-
constsum=nums.reduce((sum,cur)=>sum+cur,0)
18-
19-
// Divide sum by the length of the 'nums' array.
20-
returnsum/nums.length
16+
returnnums.reduce((sum,cur)=>sum+cur,0)/nums.length
2117
}
2218

2319
export{mean}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp