I’ve built my code and when I use console log everything works and seems to pass all the tests, but when I change the console logs to return nothing works at all. I’m lost, I’m not sure what I’m doing wrong. I’m sure it’s a simple newby problem. I’d appreciate any guidance anyone can give me. Thank you. Here’s my code.
function translatePigLatin(str) {
let vowel = ['a', 'e', 'i', 'o', 'u'];
return vowel.filter(function(e) {
if (str.charAt(0) === e) {
return str.concat('way');
} else{
return str.replace(/(\w+?)([aeiou]\w+)/i, '$2$1').concat('ay');
}
})
}
translatePigLatin("consonant");