Back
Basically, there are two methods to do it:
String.prototype.reverse_string=function() {return this.split("").reverse().join("");}
Or,
String.prototype.reverse_string = function() { var string = ""; var i = this.length; while (i>0) { string += this.substring(i-1,i); i--; } return string;}
String.prototype.reverse_string = function() {
var string = "";
var i = this.length;
while (i>0) {
string += this.substring(i-1,i);
i--;
}
return string;
I hope this will help.
Want to become a Java expert? join Java Certification now!!
31k questions
32.8k answers
501 comments
693 users