JavaScript membalikkan string
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Grepper
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
String.prototype.reverse=function(){
if(this=="") return this;
return this.charAt(this.length-1)+reverseString(this.slice(0,this.length-1));
}