Javascript Array deleteById(id)

Description

Javascript Array deleteById(id)


Array.prototype.deleteById = function(id) {
  var index = this.findIndex(function(el) { return el.id === id; }),
      marker = this.splice(index, 1)[0];

  return marker;/*from   www  .j av a 2 s.c  o  m*/
};



PreviousNext

Related