Return to Snippet

Revision: 23941
at February 17, 2010 02:57 by alvincrespo


Updated Code
var aString = "Hotel";
var rString = "";
for(var i = aString.length; i>=0; i--){
        rString += aString.substr(i,1);
}

Revision: 23940
at February 17, 2010 02:56 by alvincrespo


Initial Code
var aString = "Hotel";
	var rString = "";
	for(var i = aString.length; i>=0; i--){
		rString += aString.substr(i,1);
	}

Initial URL

                                

Initial Description
Just a simple snippet on how to reverse a string using a for loop.

Initial Title
Javascript - Reverse a String

Initial Tags
javascript, js

Initial Language
JavaScript