Return the number (count) of vowels in the given string.
We will consider a, e, i, o, u as vowels for this Kata (but not y).
The input string will only consist of lower case letters and/or spaces.
Return the number (count) of vowels in the given string.
We will consider a, e, i, o, u as vowels for this Kata (but not y).
The input string will only consist of lower case letters and/or spaces.
const vowels = ['a', 'e', 'i', 'o', 'u'];
function getCount(str) {
return str.split('').reduce((count, char) => {
if (vowels.includes(char.toLowerCase())) {
return (count += 1);
} else {
return count;
}
}, 0);
}