Window.close type for IE

Today I saw strange behavior when I typed window.close, showing function close() { [native code] }in IE and function () { [native code] }in chrome, I thought both functions.

But when I typed typeof(window.close), it showed 'object'in IE8 and 'function'in chrome.

Why is this a different behavior? What methods can I use to check the type of a variable in JavaScript? Are there other features that show this type of behavior?

thanks

+2
source share
1 answer

Look here for what you need (i.e. "function").

And here for a less readable but official ECMAScript link.

IE 8 . .

, IE8? , , , , :

var myvar = window.close;
var isfunc = Object.prototype.toString.call( myvar ) === '[object Function]';
+4

All Articles