Skip to content

Instantly share code, notes, and snippets.

@natos
Created October 6, 2011 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natos/1267152 to your computer and use it in GitHub Desktop.
Save natos/1267152 to your computer and use it in GitHub Desktop.
Eliminate duplicates from an Array
var uniq = function (arr) {
var i,
len=arr.length,
out=[],
obj={};
for (i=0; i<len; i++) {
obj[arr[i]]=0;
}
for (i in obj) {
out.push(i);
}
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment