How do you reverse a string in place (or in-place) in JavaScript when it is passed to a function with a return statement, without using built-in functions (.reverse()<
.reverse()<
String.prototype.reverse_string=function() {return this.split("").reverse().join("");}
or
String.prototype.reverse_string = function() { var s = ""; var i = this.length; while (i>0) { s += this.substring(i-1,i); i--; } return s; }