Last one failed every time , I need help!

Your code so far


function translatePigLatin(str) {
var regex = /^[aeiou]/i;
var regex2 = /^[^aeiou]+/i;
if(regex.test(str)){
  return str.replace(/^(a|e|i|o|u)(\w+)/ig, "$1$2way")
}
else if(regex2.test(str)){
return str.replace(/^([^aeiou]+)(\w+)/ig,"$2$1ay")
}
}

console.log(translatePigLatin("schwartz"))
  **Your browser information:**

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

Challenge: Pig Latin

Link to the challenge:

You seem to have accidentally deleted your description of what is happening. Can you please add it?

1 Like

please can u check this exercise in your console(copy and paste my code) bcz I’ve no idea why it’s not working .

Well, what do the failing tests say?

Ok… how are you handling the logic for words that do not contain vowels?

please chech my screenshot

Please use your words and describe which part of your code specifically is designed to handle words without vowels and tell us how that part of your code works.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.