title: What is the difference between a shallow copy and a deep copy with JavaScript arrays?
body: <p>According the MDN documentation calling <code>array.slice()</code> will create a shallow copy of the array.</p>
  
  <p>See this <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice" rel="noreferrer">MDN link for slice()</a>.</p>
  
  <p>However, if I run a simple test as such in the console:</p>
  
  <pre><code>var test = [[1,2,3],7,8,9];
  var shallow_copy = test.slice();
  </code></pre>
  
  <p>and inspect shallow_copy, I can see that the entire 2 dimensional array appears to be copied over.</p>
  
  <p>What is the difference between a shallow copy and a deep copy?  If I were to guess, I would have called this a deep copy.</p>