Here you can find the source of product()
Array.prototype.product = function() { var prod = 1; for (var i = 0; i < this.length; i++) { prod *= this[i];/*from w w w . j av a 2 s. co m*/ } return prod; }
Array.prototype.product = function(begin, end) { var total = 0; for (var i = begin >> 0 || 0, len = end + 1 >> 0 || this.length >> 0; i < len; i++) { total *= +this[i] || 0; return total; };