Created
October 29, 2015 13:44
-
-
Save fupslot/1af4b22a84604bd18f09 to your computer and use it in GitHub Desktop.
javascript, unique, uniq, filtering
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
function unique(in_list) { | |
var lookup = {}; | |
var values = []; | |
for (var i = 0; i < in_list.length; i++) { | |
if (!lookup[in_list[i]]) { | |
values.push(in_list[i]); | |
} | |
lookup[in_list[i]] = true; | |
} | |
return values; | |
}; |
Author
fupslot
commented
Oct 29, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment