Created
April 20, 2012 01:28
-
-
Save listenrightmeow/2425193 to your computer and use it in GitHub Desktop.
Extend JS natives
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.remove = function(member) { | |
var index = this.indexOf(member); | |
index > -1 && this.splice(index, 1); | |
} | |
return this; | |
} | |
['one', 'two', 'three'].remove('two'); | |
['four', 'five', 'six'].remove('three'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment