/ Published in: JavaScript
Just a simple snippet on how to reverse a string using a for loop.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var aString = "Hotel"; var rString = ""; for(var i = aString.length; i>=0; i--){ rString += aString.substr(i,1); }