Trie implementation in javascript.