Pig Latin plz help why the code did'nt meet all the require

Tell us what’s happening:

Your code so far


function translatePigLatin(str) {
  let regx1=/^[aeouiy]/i;
  let regx2=/^[^aeouiy]{2}/;
if(regx1.test(str)){
  return str.concat("way").toLowerCase();
}else if(regx2.test(str)){
  return str.replace(regx2,"").concat(str.slice(0,2),"ay")

}else{
  return str.replace(/^[^aeouiy]/,"").concat(str.slice(0,1),"ay")
}
}

translatePigLatin("consonant");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin

In the English language, y is not considered a vowel.