Hi there!! The Main problem is maybe a Bug, when I run the challenge I am not allowed to pass it because the code “Should handle words without vowels.”, btw I try a word without a vowel and… it’s ok! When I change the commented code! Is there a difference in the returned array using “Array.from(str)” or str.split("") ? Thank you!!
Your code so far
function translatePigLatin(str) {
let result= [];
let asd;
function esVocal (letra){
if (!/^[aeiou]/.test(letra)){
return true;
} else { return false;}
}
function definitivo (str) {
if(esVocal(str.charAt(0))){
//This is what I change and it is Ok for the challenge
// result= str.split("");
// in instead of the line below
result= Array.from(str);
while (esVocal(result[0])){
asd=result.shift();
result.push(asd);
}
return result;
} else {
str= str.concat('w');
return Array.from(str);}
}
return definitivo(str).join("").concat("ay");
}
console.log(translatePigLatin("x"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
.
Link to the challenge: