The document object represents the current web page displayed in the browser window. It provides access to the HTML content of the page and allows you to manipulate the structure, content, and styling using the Document Object Model (DOM). Through the document object, you can access elements, modify their attributes and content, and respond to user interactions.
The screen object represents the user's screen dimensions and display properties. It provides information about the user's monitor, such as screen width, height, color depth, and pixel density. The screen object is useful for creating responsive designs and adapting content to different screen sizes.
Window VS. Document VS. Screen
- The window object represents the browser window itself and provides methods for interacting with the browser's environment.
- The document object represents the current web page's content and structure, allowing manipulation using the DOM.
- The screen object provides information about the user's screen dimensions and display properties.