Skip to content

Instantly share code, notes, and snippets.

// 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;
}
}