Getting no return on the console - Whale Talk


I have been working on Whale Talk exercise, here is the link:

When I want to write the result to the console, I just get an empty console. No errors. I tried to run this code on Visual Studio Code as well, and got;

[Done] exited with code=0 in 0.3 seconds

I also used help from the video tutorial. Here is my code below. The problem should be in the beginning because first console.log also not returning any results. I seems not able find the problem.

const input = "Free Willy the whale";
const vowels = ["a","e","u","o","i"];
let resultArray = [];
for (let inputIndex = 0; inputIndex < input.lenght; inputIndex++){ 
  //console.log("inputIndex = " + input[inputIndex]);
  for (let vowel = 0; vowel < vowels.lenght; vowel++){
    if (input[inputIndex] === vowels[vowel]){
      if(input[inputIndex] === 'e'){
      else if (input[inputIndex] === 'u') {

Thank you in advance for your time on this.

In both of your for loops you have typoed the length method as lenght! Everything else looks okay so change input.lenght to input.length and vowels.lenght to vowels.length and that should work.

I feel so silly, thanks. And yes, I checked “length” typo possibility before writing here because I did it before! My mind plays tricks.

Happens to everyone, when you’ve been staring at code for a while it becomes a mess of letters, you sometimes just need a fresh pair of eyes!

1 Like