Not sure how else to explain the question. Here is some very simple code to demonstrate it though.
I would expect testValue and testValue2 to be [20, 21, 22], since they are passed by reference and not passed by value, as far as I understand it, and as far as it looks like since they update with the .push() method.
Does anyone know what is happening here? Why do both testValue and testValue2 seem to start passing by value after we reassign the original array?
let testArray = [1, [10, 11, 12], 3, 4, 5];
let testValue = testArray;
testArray.push(13);
testArray = [20, 21, 22];
console.log(testArray);
console.log(testValue);
//Different attempt
let testArray2 = [1, [10, 11, 12], 3, 4, 5];
let testValue2 = testArray2[1];
testArray2.push(13);
testArray2[1] = [20, 21, 22];
console.log(testArray2);
console.log(testValue2);