/ Published in: JavaScript
This extends arrays withe a removeItems operation to remove all occurances of from
usage: myArray.removeItems("words");
usage: myArray.removeItems("words");
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Array.prototype.removeItems = function(item) { var i = 0; while (i < this.length) { if (this[i] == item) { this.splice(i, 1); } else { i++; } } return this; }