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
typeofoperator returnedobjectwhere it should have returnedfunction.Removing the doctype puts IE into quirks mode. This makes sure that older websites can be viewed and older scripts don’t throw errors.