Skip to content

Instantly share code, notes, and snippets.

@arifhp86
Last active December 27, 2015 13:57
Show Gist options
  • Save arifhp86/9f183572bcf0132a80ab to your computer and use it in GitHub Desktop.
Save arifhp86/9f183572bcf0132a80ab to your computer and use it in GitHub Desktop.
function uniq(a) {
return a.sort().filter(function(v, i, a) {
return !i || v != a[i - 1];
});
}
Got a smart way
function uniq(arr) {
return arr.filter((v,i,a) => a.indexOf(v)===i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment