JS Window Global Object

2019-02-16 05:35发布

问题:

I have learned that the Window Global Object is the top level Object. He is the "box" of all the codes its Contain the DOM,BOM,and The JS.

I have learned that the window object represents an open window in a browser, and also that the window object has no constructor which means I can't create its instance.

I have learned that the object is automatically created by the Browser. What I wanted to ask is how?

I mean if it has no constructor, so the browser can't create its own instance to the object. I was thinking that the browser must be able to some way create it, so my question is how does the browser create it? I'll be happy if some one will help me to understand this.

回答1:

No constructor?

>> window.constructor
[object Window]

Well, what do you know, a constructor!

That said...

>> new Window
(X) Object does not support this action

So I guess that means only native code can create new instances of Window.