This file contains 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
// Solution to eloquentjavascript exercise second 2nd edition | |
// Chapter 5 | |
// http://eloquentjavascript.net/2nd_edition/preview/05_higher_order.html | |
// Mother-child age difference | |
function average(array) { | |
function plus(a, b) { return a + b; } | |
return array.reduce(plus) / array.length; | |
} |