title: What are the rules for an Array reference?
body: <p>The following code snippet demonstrates that arrays act like references</p>
  
  <pre><code>let arr = [1,2,3]
  let arr2 = arr
  
  
  arr[0] = 5 
  
  
  console.log(arr2) // [5, 2, 3]
  console.log(arr)  // [5, 2, 3]
  </code></pre>
  
  <p>However when I use a map function to edit an array:</p>
  
  <pre><code>let arr = [1,2,3]
  let arr2 = arr
  
  arr = arr.map(x =&gt; x * 2) 
  
  console.log(arr2) //[ 1, 2, 3 ]
  console.log(arr)  //[ 2, 4 ,6 ]
  </code></pre>
  
  <p>It doesn't act as a reference. I am expecting it to behave like this:</p>
  
  <pre><code>let arr = [1,2,3]
  let arr2 = arr
  
  function doubleNumbers(numbers){
    for (let i = 0; i &lt; numbers.length; i++) {
      numbers[i] = numbers[i] * 2
    }
    return numbers
  }
  
  arr = doubleNumbers(arr)
  
  console.log(arr2) //[ 2, 4 ,6 ]
  console.log(arr)  //[ 2, 4 ,6 ]
  </code></pre>
  
  <p>Do the <code>.map</code> <code>.filter</code> <code>.reduce</code> <code>.forEach</code> functions create a shallow copy of the array when working with it, returning that?</p>