Hello everyone, my solution for this challenge was
function translatePigLatin(str) {
// check for consonants until vowel
let regex2 = /[^aeiou]*/
if (/^[aeiou]/.test(str)) {
return str + "way"
} else if (regex2.test(str)) {
return str.replace(str.match(regex2), "") + str.match(regex2) + "ay"
}
}
I first checked if the string starts with a vowel, if not, it takes the consonants up until the first vowel and returns the string without that group and with it at the end + “ay”.
My doubt comes from checking what were the solutions provided in the hints section and I’ve found longer ones when it’s usually the opposite case, I come up with longer and more contrived solutions against the more concise soutions in hints. Would anyone provide some feedback to of the code with stricter tests? Am I missing something?