Skip to content

Instantly share code, notes, and snippets.

@bassettsj
Created August 22, 2015 20:57
Show Gist options
  • Select an option

  • Save bassettsj/77967feec50cf9c69222 to your computer and use it in GitHub Desktop.

Select an option

Save bassettsj/77967feec50cf9c69222 to your computer and use it in GitHub Desktop.
Remove Duplicates
(function() {
function removeDuplicates(list) {
var found = {};
var result = [];
var len = list.length;
var j = 0;
for (var i = 0; i < len; i++) {
var item = list[i];
if (found[item] !== 1) {
found[item] = 1;
result[j++] = item;
}
}
return result;
}
window.fastRemoveDuplicates = removeDuplicates;
})(window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment