Nodejs Array Get Max getMax()

Here you can find the source of getMax()

Method Source Code

Array.prototype.getMax = function(){
    var arr = this;
    var maxN = arr[0];
    for(var ar in arr){
        if(arr[ar] >= maxN){
            maxN = arr[ar];/*from www  . j  a v  a 2 s .co m*/
        }
    }
    return maxN;
}

Related

  1. getMAX()
    Array.prototype.getMAX = function(){
      var max = this[0];
      for(var i = 1; i < this.length; i++){
        if(this[i] > max){
          max = this[i];  
      return max;
    var array = new Array();
    array[0] = 12;
    array.push(12,34,56,78,21,53,10);
    document.write(array.getMAX());
    
  2. 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;
    };
    ...
    
  3. 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];
    
  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;
    
  5. getMaxNumber()
    var arr = [72, 23,90, 354, 3, 10]
    Array.prototype.getMaxNumber = function() {
      var max = this[0]
      this.map(function(value){
        max = Math.max(max, value)
      })
      return max
    Array.prototype.getMinNumber = function() {
    ...