Pig Latin: the last test bug

Pig Latin: the last test bug
0

#1

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.


#2

“y” is not a vowel.


#3

Wow!
Thank you, Ariel. I would never guess. English in not my native so I was completely sure to exclude ‘y’ from the consonants


#4

It’s not an uncommon mistake. I think we should probably add a sentence to that challenge stating “In English, the list of vowels is ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’.”