← ⚡ JavaScript World
⚡ Vowel Hunter
You can practise without a player, but pick a player to score points!
📖 The mission
Today you unlock
Loops inspect each item
Many levels use a loop: start with a simple value, visit each item, update the answer, then return it at the end.
💡 Hint ladder
- Make the text lowercase first: text.toLowerCase()
- Check each letter with "aeiou".includes(letter).
🧪 Coach checks
- ◯ Banana has 3
- ◯ no vowels
- ◯ ALL CAPS counts too
- ◯ empty text is 0
- ◯ mixed sentence
Live coach
Getting ready
☆☆☆
💬 You can walk through a word letter by letter and check each one.
function countLetterA(text) {
let count = 0;
for (const letter of text.toLowerCase()) {
if (letter === "a") {
count = count + 1;
}
}
return count;
}
console.log(countLetterA("Banana")); // 3
📟 It printed:
Nice — you saw it work!
📟 Output
🧩 Gaps filled! Ready to write it all yourself?