Trie code in Javascript.