I got a problem on the last test which is the should handle words without vowels. I don’t know what is the exact reason why it can’t continue.
function translatePigLatin(str) {
if (/^[aeiou]/i.test(str)){
return str + "way";
} else {
return str.replace(/(\b[^aeiou]+)(\w.*$)/, "$2$1ay");
}
}
translatePigLatin("consonant");