关于调用JavaScript全局对象的方法和属性。 The window object is a global object, which means you don’t need to use its name to access its properties and methods. In fact, the global functions and variables (the ones accessible to script anywhere in a page) are all created as properties of the global object. For example, the alert() function you have been using since the beginning of the book is, in fact, the alert() method of the window object. Although you have been using this simply as this:
alert(“Hello!”);
You could write this with the same, exact results:
window.alert(“Hello!”);
However, since the window object is the global object, it is perfectly correct to use the first version.