简体   繁体   中英

some questions about the typeof operator of IE9

I have been learning the Definitive Guide of JavaScript.i got a question about the typeof opertor. I run the script "alert(typeof window.alert)" in IE9 it proved to be return "function". but if i remove the "DOCTYPE" definition at the top of the html,the result turn to be "object".

I want to know why "DOCTYPE" definition exists or not make a different result. can anyone help me ? 3Q!

IE<=8 used to have peculiar object bindings, and the typeof operator returned object where it should have returned function .

Removing the doctype puts IE into quirks mode . This makes sure that older websites can be viewed and older scripts don't throw errors.

I found this to be a good explanation:

http://www.w3.org/QA/Tips/Doctype

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM