Loops Whale Talk Project

I am having trouble on the whale talk project on Javascript. It’s about loops. My code is supposed to display random letters between a,e,i,o,u inside the bracket when I Run it. I even went through the Project Walkthrough, did it 2 times again and again. the following code is :

const input = "Hi, My name is Wally the Whale";

const vowels = ["a", "e", "i", "o", "u"];

let resultArray = [ ];

for (let inputIndex = 0; inputIndex < input.length; inputIndex++){

  //console.log("inputIndex = " + input[inputIndex]);

  for(let vowel = 0; vowel < vowels.length; vowel++){

    if (input[inputIndex] === vowels[vowel]){

      if (input[inputIndex] === 'e'){

        result.Array.push('ee');

      } 

      else if(input[inputIndex] === 'u'){

        resultArray.push('uu')

      }

      else{

        resultArray.push(input[inputIndex]);

      } 

    } 

  }

}

console.log(resultArray);
2 Likes

Hi hi, I would encourage you to have a look at the error that should be printed to the terminal when this code is run. And try to figure out where it goes wrong so you can fix it on your own and learn a little bit of debugging.

However if you are really stuck:

Hint
result.Array.push('ee');
// should be
resultArray.push('ee'); // See the acidental period?
2 Likes

Ok thank you so much! I’ll look into it and check it again

1 Like