Return to Snippet

Revision: 25838
at April 11, 2010 23:08 by djmicahelb


Initial Code
Array.prototype.clean = function(deleteValue) {
  for (var i = 0; i < this.length; i++) {
    if (this[i] == deleteValue) {         
      this.splice(i, 1);
      i--;
    }
  }
  return this;
};

//usage

youArray = yourArray.clean("");

Initial URL


Initial Description
use this script to step through an Array and strip out the specified value...

Normally "" - to remove blank data from the Array

Initial Title
Javascript .clean Array

Initial Tags


Initial Language
JavaScript