title: Reassigning of an array and "pass-by-reference" principle in JS
body: <p>I've read that arrays and objects are "being passed by reference". But I've encountered behavior, which confuses me.</p>
  
  <p>In this piece of code, everything works as I would expect</p>
  
  <pre><code>let first = [1, 2, 3, 4, 5];
  let second = first;
  first.push(10);
  console.log(first); //[ 1, 2, 3, 4, 5, 10 ]
  console.log(second); //[ 1, 2, 3, 4, 5, 10 ]
  </code></pre>
  
  <p>I have troubles understanding the following one</p>
  
  <pre><code>let third = [1, 2, 3, 4, 5];
  let forth = third;
  third = [11, 12];
  console.log(third); //[ 11, 12 ]
  console.log(forth); //[ 1, 2, 3, 4, 5 ]
  </code></pre>
  
  <p>I would expect both variables to be equal, but it works as I'm operating primitives, not an array.</p>