Whenever I see a website in a browser, a javascript instance is launched. And I can declare a global variable in the console (DevTools);
var a = 1234567890;
This variable was declared in global scope, so I can get the value of the variable like this:
> a 1234567890
However, I can do it too;
> window.a 1234567890
Do I understand correctly that the window object is an object that contains all the global variables in the website instance in the browser? If so, to which object does the window object belong? This is a bit confusing to me;
> window Window {top: Window, window: Window, location: Location, external:, ...} > window.window Window {top: Window, window: Window, location: Location, external:, ...} > window.window.window Window {top: Window, window: Window, location: Location, external:, ...}
Is a window object a finite global object and does it have an object named window that references itself?
source share