-
-
Save IrhaAli/e433251043f21a077abfd77c5a8b449a to your computer and use it in GitHub Desktop.
Turn a phrase into pig latin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let phrase = process.argv.slice(2); | |
const translateToPigLatin = function(phrase) { | |
let pigLatinTranslation = ''; | |
for (let i = 0; i < phrase.length; i++) { | |
pigLatinTranslation += " " + phrase[i].slice(1) + phrase[i][0] + "ay"; | |
} | |
return pigLatinTranslation.substring(1); | |
}; | |
console.log(translateToPigLatin(phrase)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment