function countVowels(str) { const vowels = ['a', 'e', 'i', 'o', 'u']; let count = 0; for (let i = 0; i < str.length; i++) { if (vowels.indexOf(str[i].toLowerCase()) !== -1) { count++; } } return count; }