Skip to content

Instantly share code, notes, and snippets.

@jakeboxer
Created October 23, 2012 19:35
Show Gist options
  • Save jakeboxer/3941060 to your computer and use it in GitHub Desktop.
Save jakeboxer/3941060 to your computer and use it in GitHub Desktop.
Naive string reverse implementation
function reverseString(oldString) {
var newString = "";
for (var i = oldString.length - 1; i >= 0; i--) {
// This line does exactly the same thing as: newString = newString + oldString[i];
newString += oldString[i];
}
return newString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment