01 April 23
JavascriptWindow and Document are two important concepts in JavaScript. They are both objects that are used to access and manipulate the browser window and the HTML document.
The window
object is the global object in JavaScript. It represents the browser window and provides access to the browser's properties and methods. It is the top-level object in the browser's object hierarchy. It contains all the global variables, functions, and objects.
The window
object has several properties and methods that can be used to manipulate the browser window. For example, the window.open()
method can be used to open a new window, and the window.close()
method can be used to close a window.
The document
object is a property of the window
object. It represents the HTML document that is currently loaded in the browser window. It provides access to the HTML elements and allows you to manipulate them.
The document
object has several properties and methods that can be used to manipulate the HTML document. For example, the document.getElementById()
method can be used to get an element by its ID, and the document.createElement()
method can be used to create a new HTML element.
Frontend development