Created
April 4, 2013 02:21
-
-
Save arapehl/5307205 to your computer and use it in GitHub Desktop.
A very simple pig latin translator. Won't handle capitals or punctuation.
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(phrase) { | |
var arr, pigged; | |
arr = phrase.split(" "); | |
pigged = arr.map(function (word) { | |
var first, rest; | |
first = word.substring(0, 1); | |
rest = word.substring(1); | |
return rest + first + "ay"; | |
}); | |
return pigged.join(" "); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment