What is Window
?
Here's what I see on the console in Chrome :
window
Window {top: Window, window: Window, location: Location, external: Object,
chrome: Object…}
Window
function Window() { [native code] }
A window is a separate viewing area on a computer display screen in a system that allows multiple viewing areas as part of a graphical user interface ( GUI ). Windows are managed by a windows manager as part of a windowing system . A window can usually be resized by the user.
Windows NT is a Microsoft Windows personal computer operating system designed for users and businesses needing advanced capability. NT's technology is the base for the Microsoft successor operating system, Windows 2000.
Gates had planned to release it under the same name. However, 'Windows' name prevailed because it best describes the boxes or computing 'windows' that were fundamental to the new operating system.
It represents the browser's window. All global JavaScript objects, functions, and variables automatically become members of the window object. Global variables are properties of the window object.
Window
is a function, as you can see. It's the constructor for the windows (but you can't build new windows directly with the constructor, you usually use the Window.open
function). Window.prototype
thus holds the methods you can call on the window).
window
is the global variable holding an instance of Window
, it represents the browser window containing your document (not really a "window" usually, rather a tab in modern browsers).
You can check that
window instanceof Window
is
true
Window
is the constructor function that is used to create window
.
To see this, try alert(window.constructor === Window)
.
console outputs from the Chrome browser:
console.log(window instanceof Window); // true
console.log(window.constructor === Window); // true
console.log(this); // Window {document:document, alert:ƒ, setTimeout:ƒ,..}
console.log(window); // Window {document:document, alert:ƒ, setTimeout:ƒ,..}
console.log(Window); // ƒ Window() { [native code] }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With