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
// assume we have an array called "list_of_items" | |
// that contains the names of over 1 million items | |
// first we'll create a new hash table that will allow | |
// us to later search for elements very quickly | |
let hashtable = {}; | |
for (let item of list_of_items) { | |
if (!hashtable[item]) { | |
hashtable[item] = true; | |
} | |
} |
NewerOlder