Skip to content

Instantly share code, notes, and snippets.

@timwhitlock
Created July 22, 2010 12:34
Show Gist options
  • Save timwhitlock/485911 to your computer and use it in GitHub Desktop.
Save timwhitlock/485911 to your computer and use it in GitHub Desktop.
/**
* 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