Difficulty Level: Easy
Link to the problem: Vowel Count - Codewars
Write a function that takes a string and returns the number of vowels (letters 'a', 'e', 'i', 'o', and 'u') in the string.
function getCount(str) {
let vowelsCount = 0;
const vowels = ['a', 'e', 'i', 'o', 'u'];
for (let char of str) {
if (vowels.includes(char)) {
vowelsCount++;
}
}
return vowelsCount;
}
console.log(getCount('hello')); // 2