Javascript String reverse(num)

Description

Javascript String reverse(num)


String.prototype.reverse = function(num){
  var newString = '';
  for(var i = this.length-1; i >= 0; i--) {
     newString += this[i];/*from   ww w. j a  va 2 s .  c om*/
  }
  //newString.join()
  return newString;
}
  
"String".reverse();



PreviousNext

Related