Skip to content
Advertisement

Substring not equal to the string of the first character

I am struggling to figure out what’s wrong with my code. When the user input is “apple” I get that it doesn’t begin with a vowel.

JavaScript

Advertisement

Answer

You made a mistake using the substring method, you should say the start position in first parameter and the end position in second parameter :

JavaScript

And now it works fine 🙂 :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement