Tell us what’s happening:
every thing is working fine, just last test is not passing. Actually I don’t understand what is means. “Should handle words without vowels.”
If anyone can tell me what it need to return.
Your code so far
function translatePigLatin(str) {
let regExp = /^[aeiou]/g;
if(regExp.test(str)){
return `${str}way`;
} else {
for(let i = 0; i<str.length; i++ ) {
if(/[aeiou]/.test(str[i])) {
return `${str.slice(str.indexOf(str[i]))}${str.slice(0, str.indexOf(str[i]))}ay`;
}
}
}
return '';
// return `${str.slice(1)}${str[0]}ay`;
}
translatePigLatin("consonant");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin/