Skip to content

Instantly share code, notes, and snippets.

@gryzzly
Created October 26, 2011 09:18
Show Gist options
  • Save gryzzly/1315857 to your computer and use it in GitHub Desktop.
Save gryzzly/1315857 to your computer and use it in GitHub Desktop.
var reverseString = function ( subj ) {
var helper = subj.split (''),
i = 0, k = helper.length, len = helper.length / 2,
swap
for ( ; i < len; i += 1, k -= 1 ) {
swap = helper[ k ];
helper[ k ] = helper[ i ];
helper[ i ] = swap;
}
return helper.join ('');
};
reverseString ( 'reverseString' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment