Javascript String reverseWords(str)

Description

Javascript String reverseWords(str)

String.prototype.reverseWords = function(str) {
  var tokenArray = [];

  tokenArray = this.split(' ');
  return tokenArray.reverse().join(' ');
}



PreviousNext

Related