Skip to content

Instantly share code, notes, and snippets.

@kevmor11
Created April 4, 2017 02:48
Show Gist options
  • Save kevmor11/11d1e9f267ca37bd43e1de80efcb13a6 to your computer and use it in GitHub Desktop.
Save kevmor11/11d1e9f267ca37bd43e1de80efcb13a6 to your computer and use it in GitHub Desktop.
a program that converts given strings into pig latin
function pigLatin (string) {
var result = "";
for (var i = 1; i < string.length; i++) {
result += string[i];
}
result += string[0];
result += "ay";
return result;
};
for (var i = 2; i < process.argv.length; i++) {
var string = process.argv[i];
console.log(pigLatin(string));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment