Code not passing the test even with right output

Tell us what’s happening:

I am getting the right output for all the test cases but I dont know why the test isnt getting through for words starting with vowels or words with no vowels

Your code so far

function translatePigLatin(str) {
let r=/(^[^aeiou]+)([a-z]+)/i;
let e=/(^[aeiou])|(^[^aeiou]+$)/i;
 return str.replace(/.*$/,"way");
return str.replace(r,"$2$1ay");



Your browser information:

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

Challenge: Pig Latin

Link to the challenge:

Hey @nishanth050499, as you can see, for those cases you are logging the output with that regex,
but returning a different one.

Remember to return the value that you think it’s correct :slight_smile:

Oh yes,got it.Thanks!