Clean array by remove deleted value - Node.js Array

Node.js examples for Array:Remove Element

Description

Clean array by remove deleted value

Demo Code

Array.prototype.clean = function(deleteValue) {
  for (var i = 0; i < this.length; i++) {
    if (this[i] == deleteValue) {
      this.splice(i, 1);/*w ww.  j av a 2  s.  co m*/
      i--;
    }
  }
  return this;
};

Related Tutorials