Created
December 4, 2014 14:08
-
-
Save prio101/b42ede1f54c3380feba4 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/wirufiqada
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function pigLatin(phrase){ | |
var words , pigged ; | |
//Look for the spaces among //the words and hold them | |
words = phrase.split(" "); | |
/*Loop over and translate it in latin*/ | |
pigged = words.map(function(word){ | |
var first , rest ; | |
// Grab the firts letter of the word | |
first = word.substring(0,1); | |
// Grab the last letter of the word | |
rest = word.substring(1); | |
//Start words with ending of the words and add up the | |
// first letter in the last of the words and add 'ay' after it | |
return rest+first+"ay"; | |
}); | |
//Print the new result | |
return pigged.join(" ") ; | |
} | |
pigLatin("Some Words Dont look fine in reverse way"); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function pigLatin(phrase){ | |
var words , pigged ; | |
//Look for the spaces among //the words and hold them | |
words = phrase.split(" "); | |
/*Loop over and translate it in latin*/ | |
pigged = words.map(function(word){ | |
var first , rest ; | |
// Grab the firts letter of the word | |
first = word.substring(0,1); | |
// Grab the last letter of the word | |
rest = word.substring(1); | |
//Start words with ending of the words and add up the | |
// first letter in the last of the words and add 'ay' after it | |
return rest+first+"ay"; | |
}); | |
//Print the new result | |
return pigged.join(" ") ; | |
} | |
pigLatin("Some Words Dont look fine in reverse way"); | |
</script></body> | |
</html> |
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 words , pigged ; | |
//Look for the spaces among //the words and hold them | |
words = phrase.split(" "); | |
/*Loop over and translate it in latin*/ | |
pigged = words.map(function(word){ | |
var first , rest ; | |
// Grab the firts letter of the word | |
first = word.substring(0,1); | |
// Grab the last letter of the word | |
rest = word.substring(1); | |
//Start words with ending of the words and add up the | |
// first letter in the last of the words and add 'ay' after it | |
return rest+first+"ay"; | |
}); | |
//Print the new result | |
return pigged.join(" ") ; | |
} | |
pigLatin("Some Words Dont look fine in reverse way"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment