How the browser understand this code

i wrote like this:


var a = function b(){
	return b;
};
alert(a() === a );

and ie6~ie8 return false , ie9 chrome ff return true.
how to explain it?
and


var a = function b(){
};
alert( typeof b );

b is undefined in most of browser but is function in ie6~ie8,
that’s why?
thx

Internet Explorer doesn’t use JavaScript. Instead, it uses their own creation called JScript which is supposed to be the same, but has some bugs in it.

thank u very much

You need to be careful what you are comparing.

var a = function b(){ return typeof b; };
alert(a())
returns function in all browsers
//
alert(typeof a)
returns function in all browsers
//
alert(a() === typeof a)
returns true in all browsers.

However,
var a = function b() { return b; };
returns function b() { return b; }

alert(a() === a ); fails in IE, probably because the layout of the two functions is not exactly the same. You can see this if you look at the return info.