Whale talk project has no output

Hi all,
I am very new to javascript and I have been stuck on this project for hours. I followed the get unstuck video and double checked it multiple times. I have also been reading through some of the difficulties that other users have had. Can anyone help me figure out why when i consol.log (resultArray). nothing seems to have been sent to the array???


So what looks to be the problem is you are checking if the input is equal to the vowels, but not making sure they are of the same case.
For example: input[i] === vowel[j] --> 'i' === 'I' // Returns false

I’ll offer the soloution I would recommend in a hidden tag, since I recommend you attempt to solve your problem your self before looking at my suggestion. :grinning_face_with_smiling_eyes:


Before you do any checks on the input change the case of input to be the same as volws like show:

const input = 'fish are friends not food';
const vowels = ['A', 'E', 'I', 'O', 'U'];

// Normalize the input
const inputUpper = input.toUpperCase();

// Rest of your code

Please post all your raw code, and a link to the exercise.

Thank you so much for the help! I didn’t even realize that I had completely overlooked the state of the actual characters in my array!

I decided to change all the strings in my array to lowercase and then force them to appear how I wanted when I logged the resultArray.

Thanks again!

Glad you figured it out! :tada:

Its not so important now since you know what kind of input you will get, and its a small project.
But in the future remember this, especially when taking input from users!

Input validation/sanitation is incredibly important. Can’t tell you how many times I’ve forgotten to check case on an input and its broken my logic. :sweat_smile:

thank you so much for posting this.
i’ve been stuck on this for a while now. doesn’t help that i keep having to stop in the middle of it.
but i was following the youtube solution and for some reason i kept getting the position number of non E and non U characters

your code is much cleaner than the solution although i can’t figure out why i kept getting the position number along with the non E/U characters.
example: yummy food would yield something like ‘uu’, 8, ‘o’, 9, ‘o’

but thanks.