I'm reading the following question:
(function(){
var a = b = 3;
})();
console.log("a defined? " + (typeof a !== 'undefined'));
console.log("b defined? " + (typeof b !== 'undefined'));
it says var a=b=3 is a shorthand for:
b=3;
var a=b;
So I solved another question
var foo = {n: 1};
var bar = foo;
foo.x = foo = {n: 2};
Question: What is foo.x?
So I'm assuming it's a shorthand for:
foo = { n:2 }
foo.x = foo
But, solution is other way around. It's undefined.
Can someone explain how is it undefined?