Skip to content

Instantly share code, notes, and snippets.

@gcpantazis
Created October 4, 2011 16:14
Show Gist options
  • Save gcpantazis/1262062 to your computer and use it in GitHub Desktop.
Save gcpantazis/1262062 to your computer and use it in GitHub Desktop.
Remove Dupes
// Provided an array, remove all duplicated items.
removeDuplicates : function(anArray) {
var a = anArray.concat();
for(var i=0; i<a.length; ++i) {
for(var j=i+1; j<a.length; ++j) {
if(a[i] === a[j]) a.splice(j, 1);
}
}
return a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment