Javascript Array sum(s)
Array.prototype.sum = function (s) { s = s || Selector;/*from w ww. j av a 2s. c om*/ var l = this.length; var sum = 0; while (l-- > 0) sum += s(this[l]); return sum; };