Skip to content

Instantly share code, notes, and snippets.

@ian128K
Created October 2, 2014 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ian128K/2bfcb6b9c1fd83049663 to your computer and use it in GitHub Desktop.
Save ian128K/2bfcb6b9c1fd83049663 to your computer and use it in GitHub Desktop.
Function for reversing all the letters in a string
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