I\'ve written the following JavaScript:
var myArray = [\'a\', \'b\', \'c\']; var copyOfMyArray = myArray; copyOfMyArray.splice(0, 1); alert(myArray); // aler
Well, the only possible answer — and the correct one — is that you're not actually copying the array. When you write
var copyOfArray = array;
you're assigning a reference to the same array into another variable. They're both pointing at the same object, in other words.