What is the difference between a window and a window?

What is a Window ?

Here is 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] } 
+6
source share
2 answers

Window is a function, as you can see. This is a constructor for windows (but you cannot create new windows directly using the constructor, you usually use the Window.open function). Window.prototype thus contains methods that you can call in the window).

Window - a global variable containing an instance of Window is a browser window containing your document (in fact, this is not a "window", but a tab in modern browsers).

You can check that

 window instanceof Window 

is an

 true 
+12
source

Window is a constructor function that is used to create a Window .

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

+10
source

Source: https://habr.com/ru/post/970220/


All Articles