[SOLVED] Pig Latin and words without vowels

I have an issue with the Pig Latin algorithm scripting. It says my code does not handle words without vowels. However, I do not understand what the result should be with a word without vowels. When I try the function with the word “grrr”, the result I get is grrray. Isn’t it what it is supposed to be? From what I understand, an all-consonant word should only be one consonant bundle, right?

Correct.
Now show us some code.

This my code :

function translatePigLatin(str) {
let myString = str+"-";

let myLetter = str.charAt(0);

let regVowel = /[a|e|i|o|u|y|-]/;

let consonantBundle = [];
let finalString = “”;

let i = 0;
while(!myString.charAt(i).match(regVowel)) {
consonantBundle.push(myString.charAt(i));
i++;
}

let newString = myString.replace("-","");

let myBundle = consonantBundle.join("");

if(myLetter.match(regVowel)) {
finalString = newString+“way”;
}

else {
finalString = newString.replace(myBundle,"");
finalString += myBundle+“ay”;
}

return finalString;

}

translatePigLatin(“grrr”);

“y” is not considered a vowel.

Thank you, that was indeed the issue. (I am from France and y is considered a vowel in French):wink:

y is sometimes a vowel in English: it’s a vowel in “bypass”, but a consonant in “yes”. To keep things simple, the challenge only ever uses it in consonant form.