Whale Talk: console only printing []

Hi guys, I’ve been stuck on this issue for ever! I’ve read all the forums, watched the “step by step vid” but when I go to print my work all that shows up is

See code below.

const input = ‘Free Willy the whale’;
const vowels = [‘a’,‘e’,‘i’,‘o’,‘u’];
let resultArray = ;

for (let i = 0; i < input.length; i++) {
for (let j = 0; j < vowels.lenth; j++) {
if (input[i] === vowels[j]) {
if (input[i] === ‘e’) {
resultArray.push(‘ee’);
} else if (input[i] === ‘u’) {
resultArray.push(‘uu’);
} else {
resultArray.push(input[i]);
};
};
};
};

console.log(resultArray);

// prints only

Hello @dev0115261819. Have you checked the spelling of length here:

Does it look right?

1 Like

After nearly 3 hours of troubleshooting… I found the typo about 15mins ago…
Thanks @codeneutrino

2 Likes

I am having the same issue. Maybe another set of eyes will catch something that I’m missing.

const input = [“Free Willy 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++){
//console.log(vowels[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]);
}
}
}
}
console.log(resultArray);