Hello,
any idea in this code about of how could to resolve the problem for the case test?
translatePigLatin(“glove”) ; translatePigLatin(“schwartz”) ; translatePigLatin(“rhythm”);
any suggestion is appreciated
translatePigLatin(str) {
let regex = /^[aeiou]{1}/
if(regex.test(str)){
str = str.replace(/.{0}$/, 'way')
}else{
str = str.slice(0, 10) + str[0] + str.slice(10);
str=str.replace(str[0],'')
str = str.replace(/.{0}$/, 'ay')
}
return str;
}
translatePigLatin("rhythm");