Tell us what’s happening:
Your code so far
function translatePigLatin(str) {
var firstVowel = str.match(/[aeiou]/);
var firstpost = str.indexOf(firstVowel);
if(firstpost>0) {
return str.slice(firstpost)+str.slice(0,firstpost)+'ay';
}
return str+"way";
}
translatePigLatin("consonant");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin/