Nodejs Array Last last( set )

Here you can find the source of last( set )

Method Source Code

Array.prototype.last = function( set ) {
  if ( set !== null || set !== undefined ) {
    this[ this.length-1 ] = set;//w ww .j  a  v  a 2 s  .  c  o  m
  }

  return this[ this.length-1 ];
}

Related

  1. last()
    Array.prototype.last = function() {
        return this[this.length-1];
    
  2. last()
    Array.prototype.last = function() {
      if(this.length>0) {
        return this[this.length-1];
      } else {
        return null;
    
  3. last()
    Array.prototype.last = function() {
      return this[this.length-1];
    };
    Array.prototype.last = function() {
      return this[0];
    };
    
  4. last()
    Array.prototype.last = function() {
      return this[this.length - 1];
    };
    Array.prototype.flatten = function() {
      return this.reduce(function(a, b) {
        return a.concat(b);
      });
    };