I like to be explicit about types with these sorts of functions, and I assume Set is fast at looking up whether something belongs to it.
const vowels = new Set('aeiou');
const countVowels = (input) =>
(count, character) => (vowels.has(character)
? count + 1
console.log(countVowels('This is a TEST'));
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.