Typescript trie solution
Just a regular trie implementation in Typescript, trying to be as clean as possible.\n\ntypescript\nclass WordDictionary {\n    isWord: boolean;\n    child: {[K
Just a regular trie implementation in Typescript, trying to be as clean as possible.\n\n```typescript\nclass WordDictionary {\n    isWord: boolean;\n    child: {[Key: string]: WordDictionary};\n    constructor() {\n        this.child = {}; \n        this.isWord = false;\n    }\n\n    addWord(word: string): void {\n        let curr: WordDictionary = this;\n        for(const c of word) {\n            if(!curr.child[c]) {\n                curr.child[c] = new WordDictionary();\n            }\n            curr = curr.child[c];\n        }\n        curr.isWord = true;\n    }\n\n    search(word: string, i = 0): boolean {\n        let curr: WordDictionary = this;\n        for(;i < word.length; i++) {\n            const c = word[i];\n            if(c !== \'.\') {\n                if(!curr.child[c]) { \n                    return false; \n                }\n                curr = curr.child[c];\n            } else {\n                for(const key in curr.child) {\n                    if(curr.child[key].search(word, i + 1)){\n                        return true;\n                    };\n                }\n                return false;\n            }\n        }\n        return curr.isWord;\n    }\n}\n\n```
['Trie', 'TypeScript', 'JavaScript']