I got Pig Latin Solution but how can I without vowels

I got Pig Latin Solution but how can I without vowels
0

#1

I got error with 'Should handle words without vowels.'


function translatePigLatin(str) {
  var index = (/[aeiou]/.exec(str)).index;
  return str.slice(index)+str.slice(0, index)+(index === 0 ? 'way' : 'ay');
}

translatePigLatin("consonant");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

So you have to handle the case when your index value is null…
Like if the string is the word “my”