trie implementation in javascript, with insert and search functions