3 different fastest approaches with javascript - including one-liner
// approach 1 \n\n\nvar countPrefixes = function(words, s) {\n     let counter = 0\n     for (let i = 0; i < words.length; i++) {\n         if (words[i]) === s.
// approach 1 \n\n```\nvar countPrefixes = function(words, s) {\n     let counter = 0\n     for (let i = 0; i < words.length; i++) {\n         if (words[i]) === s.slice(0,words[i].length)) {\n            counter++\n        }\n     }\n    return counter\n};\n```\n\n// one liner approach - 2\n\n```\nvar countPrefixes = function(words, s) {\n    return words.filter((word) => word === s.slice(0,word.length)).length;\n};\n```\n\n// approach 3\n\n```\nvar countPrefixes = function(words, s) {\n    return words.filter(data=> s.indexOf(data) == 0).length;\n};\n```
['JavaScript']