JavaScript Window
The term "Windows" refers to the global object window, which represents the browser window or tab in which your JavaScript code is running. The window object provides access to various properties, methods, and events related to the browser window and its content.
console.log()
The console property in the Window Object represents the browser console that provides the ability to log information and interact with a JavaScript program running in a web page.
alert()
Displays an alert box with a message and an OK button.
prompt()
Displays a prompt box with a message, an input field, and OK and Cancel buttons.
confirm()
Displays a confirmation box with a message, OK and Cancel buttons, and returns a boolean value indicating whether the user clicked OK or Cancel.
location
Provides information about the current URL and allows scripts to change the current URL.
document
Represents the HTML document displayed in the window and provides methods for manipulating it.
innerWidth and innerHeight
Provide the width and height of the content area of the browser window, excluding toolbars and scrollbars.
scrollTo()
Scrolls the document to the specified position.
setTimeout()
Executes the function after the specified delay.
clearTimeout()
Cancels the setTimeout() method called earlier.
setInterval()
Executes the function repeatedly at the specified interval.
clearInterval()
Cancels a setInterval() method that was set earlier.
open()
The open() method is used to open a new browser window or tab programmatically.
close()
The close() method is used to close the current browser window or tab programmatically. It doesn't require any parameters. However, please note that this method can only close windows that were opened using JavaScript. It cannot close the main browser window or a window/tab that wasn't opened by JavaScript due to security restrictions
resizeby()
The resizeBy() method is used to resize the current browser window by a specified amount in pixels.
resizeto()
The resizeTo() method is used to resize the current browser window to a specified width and height.
scroll()
The scroll() method is used to scroll the content of the current window to a specified position.
These window object methods provide ways to control the behavior and appearance of the browser window using JavaScript. However, please note that some browser security settings and restrictions may limit the functionality of these methods.