function countVowels(s) {
return (s.match(/[aeiou]/gi) || []).length;
}
countVowels('Hello World'); // 3Count vowels using a regex match that captures all vowels case-insensitively.
Count the number of vowel characters (a, e, i, o, u) in a string, case-insensitive.
"hello" has 2 vowels: e, o
"aeiou" has 5 vowels
"xyz" has 0 vowels
Algorithm:
function countVowels(s: string): number {
// Return the count of vowels in s
}
countVowels('hello') // 2