Skip to content

Instantly share code, notes, and snippets.

@timwhitlock
Created July 22, 2010 12:23
Show Gist options
  • Save timwhitlock/485899 to your computer and use it in GitHub Desktop.
Save timwhitlock/485899 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 = '';
while( s ){
r += s.substr(-1,1);
s = s.slice(0,-1);
}
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment