title: If I do [a,b]=[b,a], am I modifying the array in-place with O(1) memory?
body: <p>Suppose I was given an array of character strings,</p>
  <p>such as <code>['f', 'r', 'i', 'e', 'n', 'd']</code>, and my task is to reverse it into <code>['d', 'n', 'e', 'i', 'r', 'f']</code>.</p>
  <p>I wrote the following JavaScript</p>
  <pre><code>var reverseString = function(s) {
      let h=0; let t= s.length-1;        
      while (h&lt;t) {
          [s[h], s[t]] = [s[t], s[h]];
          h++; t--;
      }
  };
  </code></pre>
  <p>So the trick I keep using in the while loop is <code>[a,b]=[b,a]</code>.</p>
  <p>How efficient is this in term of space complexity? Is there a better way you would write this in JS? Thank you</p>