Javascript Array product(begin, end)
Array.prototype.product = function(begin, end) { var total = 0;//from w w w. ja v a2 s. co m for (var i = begin >> 0 || 0, len = end + 1 >> 0 || this.length >> 0; i < len; i++) { total *= +this[i] || 0; } return total; };