In this post, Multiple left-hand assignment with JavaScript, @Crescent Fresh says JavsScript left-hand assignment is right associative. But the following code seems to me it breaks right associativeness:
var a = {n: 1};
a.x = a = {n: 2};
console.log(a.x);// undefined
Can anyone explain why a.x
is undefined?
Edit:The snippet above is to test "right associativeness", in real world please do not write similar code.