If you write
alert(var a = 'a')
You get a syntax error, varis part of the javascript syntax, it returns nothing.
However, the part a = 'a'returns something.
You can do var a = b = c = d = 'e';
And d = 'e'returns ewhich gets in c=d, which really c = 'e', etc. After you go to var, it will stop returning the value.
var a;, undefined. var a = 'b' var a; a = b;