Created
July 25, 2015 12:10
-
-
Save kevincennis/17a71a57af9fb6f0e796 to your computer and use it in GitHub Desktop.
reverse
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 reverse( str ) { | |
if ( str.length <= 1 ) { | |
return str; | |
} | |
return reverse( str.substr( 1 ) ) + str[ 0 ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment