Whale talk with consecutive vowels in input

Hi! I just finished Whale Talk and noticed an issue, but I can’t seem to solve it in my code. The output should be “OOEEAUUUUEE” but it’s returning “OEEAUUUUEE” (so, no double-o). I don’t understand why it’s cutting off the second o. Any help is greatly appreciated!

const input = 'Oh boy, sea cucumber!';

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

let resultArray = [];

for (let i = 0; i < input.length; i++) {
  //console.log(i);
  for (let j = 0; j < vowels.length; j++) {
    // console.log(j);
    if (input[i] === vowels[j]) {
      resultArray.push(vowels[j]);
    }
  }
  if (input[i] === 'e' || input[i] === 'u') {
    resultArray.push(input[i]);
  }
}

console.log(resultArray.join('').toUpperCase());

Notice how the first O is capitalised? Since the array only contains lower case letters, "O" != "o".

1 Like

Cool, I didn’t realize it was case sensitive! Thank you so much.

1 Like