Skip to content

Instantly share code, notes, and snippets.

@dieseltravis
Created August 3, 2010 02:09
Show Gist options
  • Select an option

  • Save dieseltravis/505715 to your computer and use it in GitHub Desktop.

Select an option

Save dieseltravis/505715 to your computer and use it in GitHub Desktop.
filter an array so that it only contains unique items
var unique = function(thisArray) {
var a = [];
for (var l = thisArray.length; l--;) {
if(a.indexOf(thisArray[l], 0) < 0) {
a.push(thisArray[l]);
}
}
return a;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment