Js object reference

the first type

var a = {m: 1};
a.x = a = {c: 2};
console.log(a, a.x)

the result of the above code in chorme: {c: 2}, how do you explain the result of undefined;?

the second type

var a = {m: 1};
a.x = a;
console.log(a)

the above code results in only an infinitely expanded object in chorme;

the above two cases: in the first case, my idea is
1). The operator level is higher than =; so a. X = undefined;, that is, a = {m: 1, x: undefined};
2) = operator from right to left; an is first rewritten as {c br 2}; then a.x = a;
the final result will be the same as the second result? But the result of the first kind is completely different from what I thought! How do you explain this process?
then by the way: for the second case; I see a similar assignment in the source code of vue; this undoubtedly leads to object references; object references don"t sound good; why does such a thing happen again in vue? What are the advantages and disadvantages?
there are no such problems with typing code; now I calm down and think about it and find that I don"t even know js!

Mar.24,2022

can't you see that A.M is gone, too? Because a has been reassigned.
try the following program:

var a = {m:1};
var b = a;
a.x = a = {c:2};
console.log(a, b);
Menu