How to limit a .push

Hi all!

I have a trouble with JAVASCRIPT SYNTAX, PART II Whale Talk project. I have no errors, but my code doesn’t show what it has to be.
As you can see in the image attached, E and U vowels should be repeated 2 times. I followed all the tips but my code repeats these vowels 6 times. I don’t know if I have missed something or if I should add a limitation to .push

Thank you so much for your time!

Well, when found the letter e (input[i]), the input[i] === 'e' true is true for every vowel (each iteration of the inner/nested loop). Does that make sense? If it doesn’t, I would recommend stepping through your code here:

Python Tutor - Visualize Python, Java, JavaScript, C, C++, Ruby code execution

which enable us to step through the code

I am in doubt if I should give a further hint right away. How could we mend this problem?

1 Like

Ok, my last conditional should go in the penultimate conditional.

Thank you!

exactly, but I was in doubt if I should give you this hint right away. Realizing this yourself (and understanding the flow of your program) will be more beneficial in the long run in my opinion.

so well done that you figured it out :slight_smile:

1 Like