Pig Latin Should handle words without vowels

Tell us what’s happening:
fails the requirement of:
Should handle words without vowels.

Your code so far


function translatePigLatin(str) {
  return /^[aeiou]/.test(str) ? str.concat('way') : str.replace(/^([^aeiou]+)(\w+)/,'$2$1ay');
}

console.log(translatePigLatin("glove"))

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

figured it out. despite my code truly passing the test already I made a very clear separate if statement to handle the side case of strings without vowels

function translatePigLatin(str) {
  if (str.search(/[aeiou]+/) == -1) {
    return str.concat('ay')
  }
  return /^[aeiou]/.test(str) ? str.concat('way') : str.replace(/^([^aeiou]+)(\w+)/,'$2$1ay');
}

console.log(translatePigLatin("glove"))