Hi everyone,
I can’t see where is my mistake, the video guide for this exercise follows different instructions than the ones in the codeacademy panel.
For the string “a whale of a deal!” I am gettin “aaeeeeeeoaeeeeeea” while it should be " AAEEOAEEA
)
Here is my code, Whale Project , I really hope somebody can help me.
Thank you.
the following conditional is problematic:
if (input[i] === 'e')
this condition is true for each iteration of vowels loop. So when input[i]
is e
, you get pushed into your results array: aeeiou
.
i would really recommend this tool to help you understand your code and the problem:
http://www.pythontutor.com/visualize.html#mode=edit
which very likely works better then an explanation.
Thank you for the answer and for the website.
https://repl.it/@Georgesgj/asdasd-1
I think I got the the problem was. In that website most of the people is working with python a few with JS but it was great to see how my code ran.
Thank you.
here:
else if (input[i] === 'uu'){
resultArray.push(input[i]);
}
shouldn’t this be:
else if (input[i] === 'u'){
resultArray.push('uu');
}
that you add two uu
's when a vowel is u
? (don’t know the exact requirements from the top of my head)
anyway, the rest of your logic seems good now
Much better to figure it out yourself then any explanation could possible hope to achieve.
1 Like
Way to go, but now you need to be able to work with sentences that have both capitals (‘A’) and no capitals (‘a’). And your result should be a string with capitals.
In this approach, that is correct.
Happy Coding
1 Like
I forgot to change that one. Thank you!