Programación de algoritmos intermedios - Pig Latin (Latin de los cerdos)

Tell us what’s happening:

Describe tu problema en detalle aquí.
Que esta mal ?

Your code so far

function translatePigLatin(str) {
  if (str.match(/^[aeiou]/)){
  return str = str + "way";
} 
else {
      
   
    for (let i = 0; i < str[i].length; i++)
  if (str[i].match(/^[^aeiou]+/)) {
 let resultStr = (str.match(/^[^aeiou]+/g));
    
  
  const sliceLetter = str.split(resultStr).join('');
  const slicStr = sliceLetter + resultStr + "ay";
  return slicStr;
}

}
}
translatePigLatin("consonant");

Your browser information:

El agente de usuario es: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Programación de algoritmos intermedios - Pig Latin (Latin de los cerdos)

extract the first sequence of characters from the string str that does not contain any vowel (a, e, i, o, u)

 let resultStr = (str.match(/^[^aeiou]+/)[0]);
const sliceLetter = str.slice(resultStr.length)

extract the substring starting from the end of the first sequence of characters that does not contain any vowel

Thanks a lot it work fine

1 Like