Remove element from an array - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove element from an array

Demo Code

arrayRemove: function (array, item) {
  if (!array || !item) {
    return;// w w w  .ja  v  a  2s  . co m
  }

  var idx = array.indexOf(item);

  if (idx !== -1) {
    array.splice(idx, 1);
  }
},

Related Tutorials