Pig Latin "rhytmay" not passing

Tell us what’s happening:
The last test is not passing and everything seems to be working fine.
Your code so far

function translatePigLatin(str) {
var firstVow = str.match(/[aeiou]/);
var firstPos = str.indexOf(firstVow);
if(firstPos > 0){
return str.slice(firstPos)+str.slice(0,firstPos)+ "ay";
return str + "way";

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Pig Latin

Link to the challenge:

Hello there.

translatePigLatin("rhythm") should return “rhythmay”.

What you are returning:

You will need to add more logic to get this. Hope this helps

1 Like