[JavaScript] Dynamic Programming
javascript\nvar countVowels = function(word) {\n    const vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\']);\n    let total = 0;\n    let count = 0;\n    fo
```javascript\nvar countVowels = function(word) {\n    const vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\']);\n    let total = 0;\n    let count = 0;\n    for (let i = 0; i < word.length; i++) {\n        if (vowels.has(word[i])) {\n            count += i + 1;\n        }\n        total += count;\n    }\n    return total;\n};\n```
['Dynamic Programming', 'JavaScript']