I am new to JS and was learning value and reference types in JS but I faced some confusion on the below code:
The reference to obj.arr is replaced. z = [{ x: 25 }]; simply creates a new array with a new object, { x: 25 }, inside it. Then, it places a reference to this new array into z.
obj.arr
z = [{ x: 25 }];
{ x: 25 }
z