Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse individual words in a sentence 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 #individual #words #sentence #javascript
ADD COMMENT
Topic
Name
7+4 =