Pig Latin help needed javaScript

Tell us what’s happening:

Your code so far


function translatePigLatin(str) {
  var firstVowel = str.match(/[aeiou]/);
  var firstpost = str.indexOf(firstVowel);
  if(firstpost>0) {
    return str.slice(firstpost)+str.slice(0,firstpost)+'ay';

  }
  return str+"way";
}

translatePigLatin("consonant");

Your browser information:

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

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

If the word doesn’t have vowels, firstVowel will be null, firstpost will be -1 and it will go to the else statement, so it will have "way" added at the end. Instead you need to add "ay" at the end of a word without vowels

let me try thank you