Piglatin-help, pass the last test

Hey!
I have gotten stuck on passing the last test, and I keep getting “should handle words without vovels” as the error message, even though it seems to be returning the right things…
Can someone please help me?

function translatePigLatin(str) {

let reg = /[aeiouy]/;
let reg2 = /[aeiouy]/gi;
let temp = “”;
let piglatin = “”;
let cut = 0;
let start = “”;

if(str[0].match(reg)){
piglatin = str+“way”;
}else if(str.match(reg2) === null){
piglatin= str+“ay”;
}else{
cut = str.indexOf(str.match(reg));
start = str.slice(0, cut);
temp = str.slice(cut, str.length);
temp+= start;

piglatin= temp + "ay";

}
return piglatin;
}
translatePigLatin(“hall”);

//hall returns allhay
//all returns allway
//ll returns llay

If you try to match vowels and there is no vowel in the string then the problem begins. It becomes quite easy if you find consonant or consonant cluster at the beginning of the str like below.

// match a consonant or a consonant cluster at the beginning
let reg = /^[^aeiou]/;
let match = str.match(reg);
if (match) {
  // consonant at the beginning; also, there may be no vowel
  // match[0] is the consonant or consonant cluster
  // "string".substr(from, ?length) returns sub-string
  return statement
} else {
  // vowel at the beginning
  return statement
}

Happy coding!