Tell us what’s happening:
Guess there is a bug in tests.
My code does not pass the test “Should handle words without vowels.”
Your code so far
const consonantRe = /^[B-DF-HJ-NP-TV-XZ]*/gi;
function translatePigLatin(str) {
const startConsons = str.match(consonantRe)[0];
if (!startConsons) {
return str + 'way';
}
return str.substr(startConsons.length) + startConsons + 'ay';
}
translatePigLatin("consonant");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 OPR/57.0.3098.106
.