The core object of the BOM is window, which represents an instance of the browser.
In the browser, the Window object is (1) an interface to access the browser window via JavaScript
(2) Global objects specified by ECMAScript
1. Global scope
ECMA-266 defines objects: Built-in objects (such as Object, Array, String, Function) and monolithic built-in objects (global and math)
In fact, there are no global variables and global functions; All properties and functions defined in the global scope are properties of global objects. In addition, all constructors of native reference types (like object, function) are also properties of global. All reference types inherit object by default.
Web browsers implement this global object as part of a Window object, so variables and functions declared in the global scope become properties and methods of the Window object.
2. Window relationship and framework
If the page contains frames, each frame has its own window object, which is saved in the Frames collection (the numeric index starts at 0, from left to right, top to bottom). Each Window object has a Name property that contains the names of the frames.
The top object always points to the highest (most outer) layer of the frame, which is the browser window.
For any code written in the framework, the window object points to a specific instance of that frame, not to the top-level frame.
The parent object always points to the immediate upper frame of the current frame.
JS Window Object