Please help me where is my mistake

Tell us what’s happening:

Your code so far

function translatePigLatin(str) {
  let firstel =[];
  let secondel;

  function check(el){
    let reg = /^[aeiouy]/;
    return reg.test(el);

    return str +='way';
   firstel = str.split('');
    secondel = firstel.shift();
  return firstel.join('') + 'ay';


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.

Link to the challenge:

In the English language, “y” is not a vowel. Also, what if the word has no vowels, like in the word “rhythm”? Your function gets stuck in an infinite loop based on the while loop condition.

Thank you very much …