Last active
September 11, 2015 14:50
-
-
Save victorpolko/fc06e8765cca43145828 to your computer and use it in GitHub Desktop.
JavaScript: unique array values (simple types only)
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
var simpleUniq = function(array) { | |
return array.reduce(function(prev, curr, index, arr) { | |
if (prev.indexOf(curr) === -1) prev.push(curr); | |
return prev; | |
}, []); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment