Created
October 2, 2014 04:34
-
-
Save ian128K/2bfcb6b9c1fd83049663 to your computer and use it in GitHub Desktop.
Function for reversing all the letters in a string
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 reverseString(str) { | |
var output; | |
if((typeof str === "undefined") || (typeof str !== "string")) { | |
return "You have to pass a string as an argument." | |
} | |
output = str.split("").reverse().join(""); | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment