Skip to content

Instantly share code, notes, and snippets.

@atmd83
Created February 3, 2014 10:35
Show Gist options
  • Save atmd83/8781708 to your computer and use it in GitHub Desktop.
Save atmd83/8781708 to your computer and use it in GitHub Desktop.
Remove duplicates from javascript array
var myArray = [1, 2, 3, 1, 6, 3, 7, 2, 1];
myArray.filter(function(elem, pos, self) {
return self.indexOf(elem) == pos;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment