Pig Latin Help!

Pig Latin Help!
0

#1

Hi, I wrote the following code. I don’t know why it does not work…

function translatePigLatin(str) {

 if(str[0] ===" A || E || I || O || U") {
return str.slice(-1).push("way");
 } else {
 var newstr =  str.substr(1).push(str[0] + "ay");
 return newstr;
 }

 return str;

}

translatePigLatin(“consonant”);


#2

Heyo o/

When you try to send your solution you might saw that TypeError. So the point is you are using an Array method with a string which is not possible unless you write your own methods. Check THIS link for string methods. push is not one of them. You might want to try something different maybe.

Good luck :slight_smile: