Tell us what’s happening:
Trying to complete the challenge and even though I am getting the correct result, it is not letting me pass the challenge. I do get the correct result but it doesn’t pass. Idk what can be the problem. halp
Your code so far
// User Editable Region
let array = "Apples are tasty fruits".toLowerCase();
// let array = "Hello, World".toLowerCase();
// let array = "Your vowel count should be case-insensitive".toLowerCase();
function getVowelCount (sentence) {
let vowels = ["a", "e", "i", "o", "u"];
// let vowels = "aeiou";
let count = 0;
let splitSentence = sentence.split('');
for(let i = 0; i < splitSentence.length; i++) {
// if(vowels.includes(splitSentence[i])) {
// count++;
// // console.log(splitSentence[i]);
// }
for(let j = 0; j < vowels.length; j++) {
if(vowels[j] === splitSentence[i]) {
count++;
}
}
}
return count;
}
console.log(getVowelCount(array));
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build a Sentence Analyzer - Step 1