function translatePigLatin(str) {
let pigLatin = ‘’;
if(str.match(/^[aeoiu]/g)){
pigLatin = str + ‘way’;
}else{
pigLatin = str.replace(/(^[^aeoiu]+)(\w+)/g, ‘$2$1ay’);
}
return pigLatin;
}
translatePigLatin(“consonant”);
why is the above code not working? The console returns “should handle words without vowels”