Pig Latin My solution is not accepted

Tell us what’s happening:

My solution is working, but validation is not accepting the last two points.

translatePigLatin(“zza”) outputs azzay
translatePigLatin(“bbb”) outputs bbbay

Could you please tell me what’s the problem?

Your code so far

function translatePigLatin(str) {
    str = str.replace(/(^[bcdfghjjlmnpqrstvxz]+)?(\w*)/i, (p1, p2, p3) => {
        if (p2 !== undefined) {
            return `${p3}${p2}ay`;
        } else {
            return `${p3}way`;
  return str;


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:

It looks like you’re missing “k” and “y” as consonants.

The second to last test case is actually not testing for the case it says it is. The test description should be changed. I will open an issue on Github now for it.

What it is actually testing is a word like “schwartz” and that it expects your function to return “artzschway” instead of “wartzschay”.

You are failing the last test, because you are treating “y” as a vowel, when in the English language, “y” in a consonant. The test is using the word “rhythm”.

EDIT: @ArielLeslie - Good catch on the “k” part. I still think what the second to last test says it is testing for and what it is actually testing are different things, because the word for that test is “schwartz” which does not end in a vowel.

@RandellDawson, @ArielLeslie

Thank you for the reply guiys!