Pig Latin: not passing last condition

Tell us what’s happening:
every thing is working fine, just last test is not passing. Actually I don’t understand what is means. “Should handle words without vowels.”

If anyone can tell me what it need to return.

Your code so far


function translatePigLatin(str) {
  let regExp = /^[aeiou]/g;
  if(regExp.test(str)){
      return `${str}way`;
  } else {
      for(let i = 0; i<str.length; i++ ) {
          if(/[aeiou]/.test(str[i])) {
              return `${str.slice(str.indexOf(str[i]))}${str.slice(0, str.indexOf(str[i]))}ay`;
          }
          
      }

  }
return '';  
 // return `${str.slice(1)}${str[0]}ay`;
}

translatePigLatin("consonant");

Your browser information:

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

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

You don’t handle a case where a word does not have any vowels, you only handle words that have vowels, so if there are none, nothing happens - you aren’t returning anything.

Thanks for your reply. but my question is still there. I am not able to understand what value should I return if there is not any vowel.
If i return unchanged value than also its not passing last condition. if I return empty string, result is same.
So my only query is what i need to return if there is not any vowel.

If you return it with [orignal_string] + “ay” it should pass I believe.