Tell us what’s happening:
So why is my solution wrong? (Sorry, I can’t use links) /javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin
Your code so far
function translatePigLatin(str) {
let re =/^([^aeiouy])+/i;
let temp = str.match(re);
if(temp) {
let newStr = str.replace(re,'');
str = newStr + temp[0]+'ay';
} else {
str = str+'way';
}
return str;
}
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.109 Safari/537.36
.