JavaScript Remove Element From Array


1
2
3
4
5
6
7
8
Array.prototype.removeByElement = function(element) {
for(var i=0; i<this.length; i++) {
if (this[i] == element) {
this.splice(i, 1); // (start position, select length)
}
}
return this;
}