Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse words javascript

// HazaaZOOZ - javascript - How to reverse words in javascript

function reverseInPlace(str) {
  var words = [];
  words = str.match(/S+/g);
  var result = "";
  for (var i = 0; i < words.length; i++) {
     result += words[i].split('').reverse().join('') + " ";
  }
  return result;
}
console.log(reverseInPlace("abd fhe kdj"));
 
PREVIOUS NEXT
Tagged: #reverse #words #javascript
ADD COMMENT
Topic
Name
9+5 =