Tell us what’s happening:
I made some code that is passing all the checks except for this one:
“Should handle words where the first vowel comes in the end of the word.”
I’ve tested it with the word “the” and I get “ethay”, which I believe is correct. Does anyone know what specifically this check is looking for?
Your code so far
function translatePigLatin(str) {
var arr = str;
switch (arr[0]) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return arr.concat("way");
break
default:
var match = arr.match(/^[bcdfghjklmnpqrstv]*(?=[aeiou])/i);
if (match != undefined) {arr = arr.replace(match[0],'');return arr.concat(match[0] + "ay")}else{return arr.concat("ay")}
break;
}
}
console.log(translatePigLatin("the"));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin