Ping Latin don't work

Hello. Does not work my code. For some reason variable END equals a number. although it should represent an array.
Help me.

function translatePigLatin(str) {
var vowel = ["a", "e", "i", "o", "u", "y"];
var strOne= str.split('');
   for (var i=0; i< vowel.length; i++)  {
     for (var a=0; a<strOne.length; a++){
     if (vowel[i] == strOne[a]) 
   else    { strOne.slice(0, strOne.indexOf(strOne[a])).push(“way”)
return str = strOne.join('');                


I am wondering whether you are aware that here

end = strOne.push("way");

end will equal the length of


add to the end of the array element “way”;

The push() method adds one or more elements to the end of an array and returns the new length of the array.

Thank you!

I do not understand, why it doesn’t work with consonats?

This string

else { strOne.slice(0, strOne.indexOf(strOne[a])).push(“way”)

You need to remove y from this array, it is not a vowel (in this case and for english language)

I fixed it.
Why this string doesn’t work?

else { strOne.slice(0, strOne.indexOf(strOne[a])).push(“way”)

a little fixed
For vowel it work, for consonante it doesn’t work.

I don’t understand what you want to do in that part

I mean, you have a loop that you break after first iteration
you overwrite end at each iteration
you never change strOne but return it… (this is why nothing pass, you never change strOne, but look at your return statement)

Thank you!
I found another error. I will fix it.