title: Reverse words(not letters) for a string without using .reverse()
body: <p>The problem I am working on asks for me to write a function <code>reverseMessage()</code> that takes a string message and reverses the order of the words in place. </p>
  
  <p>The answer I first came up with works but apparently doesn't meet the <a href="https://www.interviewcake.com/question/reverse-words" rel="nofollow">requirements</a> of this task:</p>
  
  <pre><code>function reverseMessage(string) {
      return string.split(" ").reverse().join(" ");
  }
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>var string = "reversed are string your in words the now"
  var results = "now the words in your string are reversed"
  </code></pre>
  
  <p>New solution:</p>
  
  <p>I would like to split this string into an array and then loop through that array and swap the 1st index with the last index, the 2nd index with second to last index, 3rd index with the 3rd to last index, etc... until I meet in the middle.</p>
  
  <p>I am trying to make the two different functions below work:</p>
  
  <pre><code> function reverseMessage(string) {
       var array = string.split(" ");
       //loop through array and replace first index with last index, second   
       index with second to last index, third index with third to last index, etc
       for (var i = 0; i &lt; array.length/2; i++) {
           for (var j = (array.length-1); j &gt; array.length/2; j--) {
               array[i] = array[j];
               array[j] = array[i];
               messageSplit.join(",");
       }
   };
  
  
  
   function reverseMessage2(string) {
       var array = string.split(" ");
       var newArray = []
       for (var i = 0; i &lt; array.length/2; i++) {
           newArray.unshift(array[i]++);
           newArray.join(",");
           return newArray;
       }
   };
  </code></pre>
  
  <p>Am I on the right track?</p>