String.reverse() in javascript





8
Date Submitted Wed. Sep. 27th, 2006 10:51 AM
Revision 1 of 1
Scripter shachi
Tags function | reverse | String
Comments 3 comments
Turns any string backwards. If you input "Test" it gives out "tseT". Hope it's useful.

The snippet shows how to use it.

String.prototype.reverse = function(){
splitext = this.split("");
revertext = splitext.reverse();
reversed = revertext.join("");
return reversed;
}
x = new String('This is a test.');
document.write(x.reverse());
 

ABC DEF

Comments

Comments QQ @ Javascript
Mon. Oct. 2nd, 2006 9:37 AM    Scripter ctiggerf
  Comments Agree
Wed. Oct. 4th, 2006 10:19 AM    Helper Thomas
Comments Excelente
Mon. Oct. 23rd, 2006 10:04 PM    Newbie dedos

Voting