Nodejs Array Peek _peek()

Here you can find the source of _peek()

Method Source Code

Array.prototype._peek = function(){
      if(this.length > 0) return this[this.length - 1];
      return null;
   };// w ww .  ja  va  2 s. com

Related

  1. peek()
    Array.prototype.peek = function () {
      return this[this.length - 1];
    };
    
  2. peek()
    Array.prototype.peek = function(){
        if (this.length > 0){
            return this[this.length - 1];
        } else {
            return null;
    
  3. peek()
    Array.prototype.peek = function() {
        var index = Math.floor(Math.random() * this.length);
        return this[index];
    };
    
  4. peek(index)
    Array.prototype.peek = function(index) {
       if(!index) index = 0;
       return this[this.length - index - 1];