2255. Count Prefixes of a Given String
\n# Code\n\n/**\n * @param {string[]} words\n * @param {string} s\n * @return {number}\n */\nvar countPrefixes = function(words, s) {\n    return words.reduce((
\n# Code\n```\n/**\n * @param {string[]} words\n * @param {string} s\n * @return {number}\n */\nvar countPrefixes = function(words, s) {\n    return words.reduce((acc, val) => acc + s.startsWith(val), 0);\n};\n```
['JavaScript']