The issue with your code is that the return statement inside the if block ends the function prematurely after finding the first vowel. Additionally, vowel.length is incorrect, as you are trying to calculate the length of the vowel itself, which is always 1. Instead, you need to count all vowels in the string.
you’re using a global variable (vowelCount), which can cause issues if the function is called multiple times. The global variable retains its value across calls, leading to incorrect results
Convert the sentence to lowercase for case-insensitivity.
Your welcome. That’s great you have passed the challenge, but don’t post the solution code whenever you have passed the challenge. Posting solution code isn’t allowed here on forum.
thank you a lot for the solution, i worked it with an array contains vowels and each loop i check if the leter in the current loop is included in the array, but, it allways count the letter multiple times if it is exist, thank you again
the problem was not as i said before, the problem was in that the leter y in my solution is not included in the test, and when i read the code with my screenreader i don’t read each later i thught it the correct until i read your soluction leter by leter
this a problem of screen reader, thank you