Created
July 22, 2010 12:34
-
-
Save timwhitlock/485911 to your computer and use it in GitHub Desktop.
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
/** | |
* Reverse a string | |
* @param String original string | |
* @return String new string | |
*/ | |
function stringReverse( s ){ | |
var r = '', i = 0, n = - s.length; | |
while( i > n ){ | |
r += s.substr(--i,1); | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment