Created
March 16, 2020 08:42
-
-
Save ekaraman89/58cb0dc5f1b207e9c3d1f960aa1cabb8 to your computer and use it in GitHub Desktop.
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
function onlyUnique(value, index, self) { | |
return self.indexOf(value) === index; | |
} | |
// usage example: | |
var a = ['a', 1, 'a', 2, '1']; | |
var unique = a.filter( onlyUnique ); // returns ['a', 1, 2, '1'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment