I see these terms used interchangeably as the global environment for the DOM. What is the difference (if there is one) and when should I use each one?
I see these terms used interchangeably as the global environment for the DOM. What
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
windowis the main JavaScript object root, aka theglobal objectin a browser, and it can also be treated as the root of the document object model. You can access it aswindow.window.screenor justscreenis a small information object about physical screen dimensions.window.documentor justdocumentis the main object of the potentially visible (or better yet: rendered) document object model/DOM.Since
windowis the global object, you can reference any properties of it with just the property name – so you do not have to write downwindow.– it will be figured out by the runtime.