Created
October 26, 2011 09:18
-
-
Save gryzzly/1315857 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
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