Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Window and window?

Tags:

javascript

dom

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] }
like image 556
Michael Phelps Avatar asked Jun 03 '14 06:06

Michael Phelps


People also ask

What is different between windows and window?

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.

What is the difference between windows and Windows NT?

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.

Why Microsoft window is called window?

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.

What is window [] in JavaScript?

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.


3 Answers

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
like image 103
Denys Séguret Avatar answered Oct 22 '22 17:10

Denys Séguret


Window is the constructor function that is used to create window.

To see this, try alert(window.constructor === Window).

like image 31
SLaks Avatar answered Oct 22 '22 17:10

SLaks


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] }
like image 1
SridharKritha Avatar answered Oct 22 '22 17:10

SridharKritha