Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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