[Javascript] Simple Trie implementation
It\'s a pretty simple and understandable solution, written in Javascript\n\n```\nvar sumPrefixScores = function(words) {\n    const n = words.length;\n    const
It\'s a pretty simple and understandable solution, written in Javascript\n\n```\nvar sumPrefixScores = function(words) {\n    const n = words.length;\n    const trie = {_count: 0};\n    const result = [];\n    \n\t// Create our own custom trie with _count property.\n    // We are storing how many time we passed current node.\n    for (let i = 0; i < n; i++) {\n        const word = words[i];\n        \n        let node = trie;\n        for (let j = 0; j < word.length; j++) {\n            if (!node[word[j]]) node[word[j]] = {};\n            node = node[word[j]];\n            node._count = (node._count || 0) + 1;\n        }\n    }\n    \n\t// Collect all _count values together as a result\n    for (let i = 0; i < n; i++) {\n        const word = words[i];\n        let count = 0;\n        \n        let node = trie;\n        for (let j = 0; j < word.length; j++) {\n            node = node[word[j]];\n            count += (node._count || 0);\n        }\n        \n        result[i] = count;\n    }\n    \n    return result;\n};
['Trie', 'JavaScript']