Nodejs Array Min minimum()

Here you can find the source of minimum()

Method Source Code

/*//from  w  w  w.j a  v a  2s  .c  o  m
 * Extends array object with a function to retrieve the minimum value from an array
 * Requirement : Array only contains integers
 **/

Array.prototype.minimum = function()
{
    var min = this[0];
    for(el in this)
    {
        if(this[el] < min)
        {
            min = this[el] ;
        }
    }
    return min;
};

Related

  1. min(func)
    Array.prototype.min = function (func) {
        return func === undefined ? Math.min.apply(null, this) : Math.min.apply(null, this.select(func));
    };
    
  2. min(k)
    Array.prototype.min = function (k) {
      return Math.min.apply (null, this.column (k));
    };
    
  3. min(prop)
    Array.prototype.min = function (prop) {
        var min = prop ? this[0][prop] : this[0];
        var len = this.length;
        for (var i = 1; i < len; i++) {
            var item = prop ? this[i][prop] : this[i];
            if (item < min) {
                min = item;
        return min;
    };
    
  4. min(s)
    Array.prototype.min = function (s) {
      s = s || Selector;
      var l = this.length;
      var min = s(this[0]);
      while (l-- > 0)
        if (s(this[l]) < min) min = s(this[l]);
      return min;
    };
    
  5. minimum()
    Array.prototype.minimum = function () {
      return this.reduce(function (min, aValue) {
        return Math.min(min, aValue);
      }, this[0]);
    };