Whale Talk code out of whack - Free Willie!

Screen Shot 2019-06-19 at 4.45.02 PM

Hi - I hope i formatted the following okay (it said to use 3 back tics" = I also tried to paste screen shot above but maybe it didn’t work)

I WATCHED THE HELP VIDEO SO MANY TIMES; i’m getting a really weird result.

const vowels = ['a', 'e', 'i', 'o', 'u'];
let resultArray = [];
for (let inputIndex = 0; inputIndex < input.length; inputIndex++) {
  for (let vowel = 0; vowel < vowels.length; vowel++) {
    if(input[inputIndex] === vowels[vowel]){
      if(input[inputIndex] === 'e'){
        resultArray.push('ee')
      } else if(input[inputIndex] === 'u'){
            resultArray.push('uu')
        } else              resultArray.push(input[inputIndex]);
       }

The reason for your strange results is the placement of your console.log() statement. It should be completely outside of the code block(s) for your for loops. It currently resides inside the inner for loop, so it is being repeated far too often. For this project it should be the last line of code. You are also missing the curly braces around your else code block. This won’t keep your code from running, but it is bad form. Hope this helps!

Ah! Those will be easy fixes; hope to memorize; thank you so so much for your help!!!

1 Like