Skip to content

Instantly share code, notes, and snippets.

@mofas
Created May 16, 2015 14:36
Show Gist options
  • Save mofas/03294cf6e4f83e6c8bb7 to your computer and use it in GitHub Desktop.
Save mofas/03294cf6e4f83e6c8bb7 to your computer and use it in GitHub Desktop.
String reverse
String.prototype.reverse = function(){
var m = this.length >> 1,
f = this.substring(0,m),
t = this.substring(m,this.length);
return m == 0 ? t : this.reverse.apply(t) + this.reverse.apply(f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment