Skip to content

Instantly share code, notes, and snippets.

@victorpolko
Last active September 11, 2015 14:50
Show Gist options
  • Save victorpolko/fc06e8765cca43145828 to your computer and use it in GitHub Desktop.
Save victorpolko/fc06e8765cca43145828 to your computer and use it in GitHub Desktop.
JavaScript: unique array values (simple types only)
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