Posted By

brianyang on 02/01/11


Tagged


Versions (?)

Reverse a string


 / Published in: JavaScript
 

  1. String.prototype.reverse = function(){
  2. splitext = this.split("");
  3. revertext = splitext.reverse();
  4. reversed = revertext.join("");
  5. return reversed;
  6. }
  7. x = new String('This is a test.');
  8. document.write(x.reverse());

Report this snippet  

You need to login to post a comment.