Javascript Array getMax=function()

Description

Javascript Array getMax=function()


/**// w  w  w  . j  a  v  a 2s.co  m
 * 
 */
Array.prototype.getMax=function(){

  var max=0;
  for(var x=1;x<this.length;x++){
    if (this[x]>this[max]){
      max=x;
    }
  }
  return this[max];
};



PreviousNext

Related