Created
December 27, 2016 09:48
-
-
Save sushiljainam/1064f7b8703de80b7b8f9147b4a7ee1b to your computer and use it in GitHub Desktop.
enhancing array capabilities
This file contains 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.pushUnique = function(elem) { | |
if(this.indexOf(elem) == -1){ | |
this.push(elem); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment