JavaScript: window, document and screen
Window
The JavaScript window object is the top of the JavaScript Object and represents the browser window. and it is supported by all browsers. All global JavaScript objects , functions, and variables automatically become members of the window object. The window is the first thing that gets loaded into the browser .
Well, the window is the first thing that gets loaded into the browser. This window object has the majority of the properties like length, inner Width, inner Height, name, if it has been closed, its parents, and more.
WINDOW object and DOCUMENT object ARE NOT THE SAME!!
Document
The document object is your html, php, or other document that will be loaded into the browser. The document actually gets loaded inside the window object and has properties available to it like title, URL, cookie, etc.. When an HTML document is loaded into a web browser , it becomes a document object. It is the root node of the HTML document. The document actually gets loaded inside the window object and has properties available to it like title, URL, cookie, etc. HTML documents, served with the “text/html” content type, also implement the HTML Document interface, whereas XML and SVG documents implement the XMLDocument interface.
Screen
Screen is a small information object about physical screen dimensions . It can be used to display screen width, height, color Depth, pixel Depth etc. It is not mandatory to write window prefix with screen object. It can be written without window prefix.