Whale Talk Project: I can't figure out why my E's are being tripled

Hello! so here I have my end result so far for the whale talk project… I can’t figure out why the E’s are being tripled.

I even went back through the material and re learned scopes and if else statements to no avail so any help is super appreciated thank you!

Just found it on line 9 if I change it to “else if” instead of “if” it stops tripling the E’s but I’m still not clear on why it fixes it.

I also realized I didn’t initialize those variables at the beginning so I fixed that too lol

I FINALLY figured it out. So if I don’t put in ‘else if’ the program thinks it’s a new if chain to go through and it pushes the E’s from the down line 6 too go through said if statement on line 9 and since ‘e’ does not === ‘u’ it pushes that third e through that final else statement and back into the resultArray.

Sorry, I suppose I should have waited longer before posting.