Q. 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.
//#my solution
function getCount(str) {
let c=0;
for(let i=0; i<str.length;i++){
switch(str[i]){
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
c++;
break;
default:
break;
}
}
return c;
}
//other solution
function getCount(str) {
return str.split('').filter(c => "aeiouAEIOU".includes(c)).length;
}