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("The input index is = " + input[inputIndex]); Prints the input as letters
for(let vowel = 0; vowel < vowels.length; vowel++) {
//console.log('The vowel = ' + vowel); Prints the amount of vowels 0-4
if (input[inputIndex] === vowel[vowels]){
if(input[inputIndex] === 'e') {
resultArray.push('ee');
} else if (input[inputIndex] === 'u') {
resultArray.push('uu');
} else{
resultArray.push(input[inputIndex]);
}
}
};
}
console.log(resultArray.join(’’).toUpperCase());
For some reason whenever I try to log my code, logs the resultArray as undefined. I have tried searching through the internet to see if someone has ran into the same problem but I have had no luck.