String reverse with test case - Node.js String

Node.js examples for String:Case

Description

String reverse with test case

Demo Code

String.prototype.strReverse = function() {
  var length = this.length,
      strcopy = '';
  for(var i = length-1; i >= 0; i--) {
    strcopy+=this[i]/*from   ww  w  . j a  v  a2 s .  com*/
  }
  return strcopy;
}

console.log("  0011".strReverse())

Related Tutorials