I believe elem is a reference of arr1;
No it's not. Everything in JavaScript is pass by value. Meaning when the an assignment takes place, e.g.
x = y;
the right hand side (y in this case) is evaluated to a value, and that value is "copied" over to x.
In other words, after the evaluation of the left hand side, there is no knowledge of how the value was created in the first place or where it was stored. That's why changing the array later on has no impact on the copy of the value that was assigned to elem.
Here is some ASCII art:
We start with two containers (arr and elem). arr contains a reference to an array (object). elem is empty.
+----------+
var arr = ['a', 'b', 'c']; |0: 'a' |
var elem; |1: 'b' |
|2: 'c' |
|length: 3 |
+----------+
^
|
|
| | | |
| #obj1 | | |
| | | |
+-------+ +-----+
arr elem
When the assignment takes place, the right hand side, arr[0] is evaluated to a value. The result of the evaluation is the string 'a'. That string is put into elem:
+----------+
elem = arr[0]; |0: 'a' |
|1: 'b' |
|2: 'c' |
|length: 3 |
+----------+
^
|
|
| | | |
| #obj1 | | 'a' |
| | | |
+-------+ +-----+
arr elem
As you can see, there is no connection between elem and the array.
Later, when the array is spliced, it is mutated to:
+----------+
arr.splice(1, 1); |0: 'b' |
|1: 'c' |
|length: 2 |
+----------+
^
|
|
| | | |
| #obj1 | | 'a' |
| | | |
+-------+ +-----+
arr elem
Because the is no connection to elem, it didn't change.