You will be given a string and your goal is to reverse every word in it.
reverseWords(string) should return the origin string with every word reversed.
There are some conditions:
- every word should be reversed but the string as a whole should not be reserved.
- don't use
Array.reverse()method.
Example:
reverseWords('This is a string of words') // 'sihT si a gnirts fo sdrow'