Last active
May 3, 2016 04:58
-
-
Save nicksheffield/7daaf36287c42dfd135a4f20a19d3ede to your computer and use it in GitHub Desktop.
Get average number using Array.prototype.reduce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function avg(a) { | |
| return a.reduce((s, n) => n = s + n) / a.length | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment