var a={h1: '11'};
var b=a;
a=null;
console.log(a,b) //null {h1: "11"}
The reason for the above example: a=null just cancels the reference, but does not change the heap, and b still points to the original heap and still retains the old value.
var a = {n: 1};
var b = a;
a.x = a = {n: 2}; // 等价于 b.x = a = {n: 2};
console.log(a); //{n:2}
console.log(a.x); //undefined
console.log(b); //{n:1,x:{n:2}}
console.log(b.x); //{n: 2}
The reason for the above example: the writing of a={n:2} changes the reference of a, but the reference of b remains unchanged;