Question: What is the value of foo.x?
My guess should be the same as foo, which should point to {n:2}. but when I run it through node, if give me undefined
. Why?
var foo = {n: 1};
var bar = foo;
foo.x = foo = {n: 2};
Question: What is the value of foo.x?
My guess should be the same as foo, which should point to {n:2}. but when I run it through node, if give me undefined
. Why?
var foo = {n: 1};
var bar = foo;
foo.x = foo = {n: 2};