Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 459 Bytes

File metadata and controls

19 lines (12 loc) · 459 Bytes

Reverse words

Description

You will be given a string and your goal is to reverse every word in it.

Implementation

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'