Today I saw weird behavior
when I typed window.close it showing function close() { [native code] } in IE and function () { [native code] } in chrome, I thought both are function.
But when I typed typeof(window.close) it showing 'object' in IE8 and 'function' in chrome.
Why this different behavior?
What are the ways I can use to check type of a variable in JavaScript?
Is there other functions which shows this type of behavior?
Thanks
Look here for what you should have (ie
"function").And here for the less readable but official ECMAScript reference.
IE 8 simply doesn’t follow the norm. That’s really not the sole occurrence.
Regarding the How to test if a variable is a function on IE8 ? question, I can’t test it myself but this probably works :