Remove item from array - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove item from array

Demo Code

Array.prototype.removeItem = function (itemToRemove) {

  var index = this.indexOf(itemToRemove);
  var itemFoundInArray = (index != -1);
  if (itemFoundInArray) {
    this.splice(index, 1); // remove item at that index
  }/*from  w w w. j  a v  a 2 s .c o m*/
};

Related Tutorials