Hello, I have a problem passing the last test: Should handle words without vowels
function translatePigLatin(str) {
let vowelRegEx = /[aeiou]/g;
// in case we have no vowels just return string
// This is working with string with no vovwels, but still not passing last test
if(!str.match(vowelRegEx)) return str;
// if string starts with a vowel append `way` at end
if (str[0].match(vowelRegEx)) {
str += 'way';
// if str contains a vowel move first consonant (or consonant cluster)
// to the end of the str and add `ay`
} else if (str.match(vowelRegEx)) {
str = str.replace(/([^aeiou]+)(\w*)/, '$2$1' + 'ay'); //?
}
return str;
}
console.log(translatePigLatin("rctsfg"))