title: Array is being altered but wasn't used in left-side assignment
body: <pre><code>var userID = 1;
  var users = [1, 2, 3];
  
  console.log(users + " initial users array");
  
  testFunction();
  
  function testFunction() {
      var usersWithoutMe = users; // altering usersWithoutMe alters users from now on
      var index = usersWithoutMe.indexOf(userID);
      if (index != -1) {
        usersWithoutMe.splice(index, 1);
      }
      console.log(usersWithoutMe + " new users array without my own id");
  
  }
  
  console.log(users + " initial users array got altered");
  </code></pre>
  
  <p>How can I prevent this from happening, and why is it doing this?</p>
  
  <p>Note: I fixed it by doing : <code>var usersWithoutMe = users.slice(0);</code> instead of just <code>var usersWithoutMe = users</code> and it fixed it, but I'd still like to understand why it didn't work initially...</p>