Skip to content

Instantly share code, notes, and snippets.

@haio
Created July 9, 2014 16:11
Show Gist options
  • Save haio/87af662496201fa96ef1 to your computer and use it in GitHub Desktop.
Save haio/87af662496201fa96ef1 to your computer and use it in GitHub Desktop.
Array deduplication
var array = ['Lorem', 'Lorem', '<3', 'Ipsum', 'Ipsum'];
array = array.filter(function (item, pos, self) {
return self.indexOf(item) === pos;
});
console.log(array);
// ["Lorem", "<3", "Ipsum"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment