title: JavaScript: Amend the Sentence
body: <p>I am having trouble below javaScript problem.</p>
  <p>Question:
  You have been given a string s, which is supposed to be a sentence. However, someone forgot to put spaces between the different words, and for some reason they capitalized the first letter of every word. Return the sentence after making the following amendments:</p>
  <p>Put a single space between the words.
  Convert the uppercase letters to lowercase.</p>
  <p>Example</p>
  <p>&quot;CodefightsIsAwesome&quot;, the output should be &quot;codefights is awesome&quot;;</p>
  <p>&quot;Hello&quot;, the output should be &quot;hello&quot;.</p>
  <p>My current code is:</p>
  <p><a href="https://i.stack.imgur.com/bXVoi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bXVoi.png" alt="" /></a></p>
  <p>Right now, my second for-loop just manually slices the parts from the string.
  How can I make this dynamic and insert &quot;space&quot; in front of the Capital String?</p>