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"))