Console only printing []

Hi all, I keep checking for typos and anything else that I may be doing wrong, but I don’t see anything. Could you tell me what I’m not seeing?
I checked the video walkthrough. I did this up till step 12, since I only see printed to the console.

const input = 'I threw a burrito at him!'
const vowels = ['a', 'i', 'o', 'e', 'u']
let resultArray = []

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

https://www.codecademy.com/courses/introduction-to-javascript/projects/whale-talk

1 Like

The issue is just here, you’ve used vowels[i], however that should be vowels[j] as vowels is drawing from the inside loop! Change that and the code works perfectly.

2 Likes

I’m not completely sure if this is what’s causing it, but here:

for (let i = 0; i < input.length; i++){
for (let j = 0; j < vowels.length; j++) {

>  if (input[i] === vowels[i]){

if (input[i] === 'e'){ //step9
   resultArray.push('ee')
 }

Instead of doing vowels[i] you should replace the i with j, because j represents numbers that represent the indexes in vowels.

2 Likes

Ahhh thank you so much!

1 Like