Created
April 4, 2017 02:48
-
-
Save kevmor11/11d1e9f267ca37bd43e1de80efcb13a6 to your computer and use it in GitHub Desktop.
a program that converts given strings 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
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