Pig Latin - why the last condition test returns incorrect?

Tell us what’s happening:

Your code so far


function translatePigLatin(str) {
    let arr = str.split("");
    let arr2 = [];
    let i = 0;
    
    while (!["a", "e", "i","o", "u", "y"].includes(arr[i]) && i < arr.length) {
      arr2.push(arr[i]);
      i++;
    
    }
    if (arr.length === arr2.length) {
      return str + "ay"
    }
    if (arr2.length == 0) {
      return str + "way";
    }return str.substring(arr2.length) + str.substring(0, arr2.length) + "ay";
}

translatePigLatin("ggglv");

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36.

Link to the challenge:

If you check word “gwtn” you will get “gwtnay” but for some reason I cannot pass the last test.

you have a y in your vowel array take it out it should pass, y is not a vowel