Created
September 20, 2016 17:08
-
-
Save kutyel/2221aabf8cb98fef8178b409d55d2dba to your computer and use it in GitHub Desktop.
Average of numbers (JavaScript)
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
averages = n => n ? n.reduce((x,y,i,z) => i < z.length - 1 ? x.concat((y + z[i + 1] || 0) / 2) : x, []) : []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment