Nodejs Array Product product(begin, end)

Here you can find the source of product(begin, end)

Method Source Code

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;/* w  w  w.  j a v a 2 s. c o  m*/
   }

   return total;
};

Related

  1. product()
    Array.prototype.product = function() {
        var prod = 1;
        for (var i = 0; i < this.length; i++) {
            prod *= this[i];
        return prod;