Remove first and last element from array - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove first and last element from array

Demo Code

Array.prototype.removeFirst = function() {

    this.splice(0, 1);/*from  w  w w. j av a 2  s . co  m*/
};

Array.prototype.removeLast = function() {

    this.splice(this.length - 1, 1);
};

Related Tutorials