Created
September 28, 2013 17:57
-
-
Save maxkrieger/6744666 to your computer and use it in GitHub Desktop.
A piglatin function :D
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(pig){ | |
var pigArr = pig.split(""); | |
var firstLetter = pigArr.splice(0, 1); | |
pigArr.push(firstLetter + "ay"); | |
var result = ""; | |
for(var i=0; i<pigArr.length; i++){ | |
result += pigArr[i]; | |
} | |
return result; | |
} | |
console.log(pigLatin("max")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment