Created
August 22, 2015 20:57
-
-
Save bassettsj/77967feec50cf9c69222 to your computer and use it in GitHub Desktop.
Remove Duplicates
This file contains hidden or 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() { | |
| 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