Skip to content

Instantly share code, notes, and snippets.

@detj
Created July 10, 2012 10:27
Show Gist options
  • Save detj/3082533 to your computer and use it in GitHub Desktop.
Save detj/3082533 to your computer and use it in GitHub Desktop.
Erase an item from an array
Array.prototype.erase = function(item) {
for( var i = this.length; i--; ) {
if( this[i] === item ) {
this.splice(i, 1);
}
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment