I’m trying to pass tests.
Last test is “Should handle words without vowels.”
In this case my code takes a string without vowels and adds a “ay”.
What did I get wrong?
Your code so far
function translatePigLatin(str) {
let myStr = str;
myStr = myStr.replace(/^([bcdfghjklmnpqrstvxzw]+)(.*)/, "$2$1ay");
myStr = (myStr == str)? myStr + "way" : myStr;
return myStr;
}
translatePigLatin("qwrt");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin