SHARE
TWEET

Reverse words letters in a string

cherokee Jul 25th, 2014 198 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reverseWordsInString(str) {
  2.     var arrWords = str.split(' ');
  3.     arrWords.forEach(function (element, index, arr) {
  4.         arr[index] = arr[index].split('').reverse().join('');
  5.     });
  6.     console.log(arrWords);
  7. }
  8.  
  9. reverseWordsInString("Hello, how are you.");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top