A trie is a key-value pair data structure, that allows you to store a value, by associating it with some string value. If you happen to know what that string value is, then you can retrieve the original value associated with the string.
If the string value is not associated to any value, then a null is returned.
As opposed to an associative array, tries actually save memory, by not storing redundant character prefixes of strings.
import Trie from './trie';
const set = new Trie();
set.set('foo', 42);
set.set('bar', 3);
set.set('baz', 10);
set.set('foobar', 20);
console.log(set.get('foo')); // -> 42
console.log(set.get('bar')); // -> 3
console.log(set.get('baz')); // -> 10
console.log(set.get('foobar')); // -> 20
console.log(set.get('nothing')); // -> null