Created
July 9, 2014 16:11
-
-
Save haio/87af662496201fa96ef1 to your computer and use it in GitHub Desktop.
Array deduplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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