Skip to content

Instantly share code, notes, and snippets.

View paulmatheson's full-sized avatar

Paul Matheson paulmatheson

View GitHub Profile
@spamwax
spamwax / gist:99f1a2d9f21ed463d157
Last active November 22, 2017 22:34
Solution to eloquentjavascript exercise second 2nd edition (Chapter 5) eloquent javascript
// 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;
}