Return the number (count) of vowels in the given string.
We will considera, e, i, o, uas vowels for this Kata (but not y).
The input string will only consist of lower case letters and/or spaces.
주어진 string에 모음이 몇 개 들어가있는지 확인하는 문제이다.
function getCount(str) {
var vowelsCount = 0;
// enter your majic here
var strArr = str.split('')
strArr.forEach(element => {
switch (element) {
case "a":
vowelsCount++;
break;
case "e":
vowelsCount++;
break;
case "i":
vowelsCount++;
break;
case "o":
vowelsCount++;
break;
case "u":
vowelsCount++;
break;
}
})
return vowelsCount;
}
function getCount(str) {
return (str.match(/[aeiou]/ig)||[]).length;
}