var a={n:1};
var b=a;
a.x=a={n:2};
console.log(a.x);//undefined
console.log(b.x);//{n:2}
The execution order of connection and so on is from right to left, so the above code can be understood as, ax=(a={n:2}),
Because the precedence of the . operator is greater than the =
So the real execution order should be
1. First declare the x attribute of the a object, that is, ax is equivalent to {n:1}.x, which means that the following equations are stored in the {n:1} object.
2. Assign value to a, pointing to {n:2}
3. Then assign a value to ax. At this time, because of 1, the a of ax at this time points to {n:1}
For details, please refer to http://www.cnblogs.com/ooooevan/p/6024770.html