Nodejs Array Get Max getMAX()

Here you can find the source of getMAX()

Method Source Code

Array.prototype.getMAX = function(){
   var max = this[0];
   for(var i = 1; i < this.length; i++){
      if(this[i] > max){
         max = this[i];   //w w w . ja v a 2 s. c o  m
      }   
   }
   return max;
}

var array = new Array();
array[0] = 12;
array.push(12,34,56,78,21,53,10);

document.write(array.getMAX());

Related

  1. getMax()
    Array.prototype.getMax = function() {
      var max = this[0];
      for (var x = 1; x < this.length; x++) {
        if (this[x] > max) {
          max = this[x];
      return max;
    };
    ...
    
  2. getMax()
    Array.prototype.getMax = function(){
      var temp = 0;
      for(var x=1; x<this.length; x++){
        if(this[x]>this[temp]){
          temp = x;
      return this[temp];
    
  3. getMax()
    Array.prototype.getMax = function(){
        var arr = this;
        var maxN = arr[0];
        for(var ar in arr){
            if(arr[ar] >= maxN){
                maxN = arr[ar];
        return maxN;
    ...
    
  4. getMax()
    Array.prototype.getMax=function(){
      var max=0;
      for(var i=0;i<this.length;i++){
        max=this[i]>max?this[i]:max;
      return max;