Tell us what’s happening:
So I’m doing this challenge and i have trouble finding out how to get the test case glove right, how do you code it to include both ‘gl’ instead of just ‘g’ to pushed into the back?
Your code so far
function translatePigLatin(str) {
let word = str;
const firstLetter = str.split('')[0];
let newWord = '';
//check if first letter is consonant
function isConsonant() {
return /[aeiou]/.test(firstLetter)
}
if(isConsonant() === false) {
newWord = word.substring(1).concat(`${firstLetter}ay`);
return newWord;
} else {
newWord = word.concat(`way`);
return newWord;
}
return newWord
}
translatePigLatin("aonsonant")
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin