function even(n) { return !(n % 2); } array.prototype.sum = function() { this.reduce(function(a, b) { return a + b; }); }; xs.filter(even).sum()