Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
189
rated 0 times [  191] [ 2]  / answers: 1 / hits: 174924  / 12 Years ago, tue, march 27, 2012, 12:00:00

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?


More From » javascript

 Answers
20

window is the main JavaScript object root, aka the global object in a browser, and it can also be treated as the root of the document object model. You can access it as window.


window.screen or just screen is a small information object about physical screen dimensions.


window.document or just document is the main object of the potentially visible (or better yet: rendered) document object model/DOM.


Since window is the global object, you can reference any properties of it with just the property name - so you do not have to write down window. - it will be figured out by the runtime.


[#86579] Monday, March 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
debras

Total Points: 307
Total Questions: 98
Total Answers: 112

Location: Maldives
Member since Tue, Dec 21, 2021
3 Years ago
;