Window 和 window 和有什么不一样? [英] What is the difference between Window and window?

查看:51
本文介绍了Window 和 window 和有什么不一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 Window ?

这是我在 Chrome 控制台上看到的:

Here's 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] }

推荐答案

Window 是一个函数,如你所见.它是 windows 的构造函数(但你不能直接用构造函数构建新窗口,你通常使用 Window.open 函数).Window.prototype 因此保存了您可以在窗口上调用的方法).

Window is a function, as you can see. It's the constructor for the windows (but you can't build new windows directly with the constructor, you usually use the Window.open function). Window.prototype thus holds the methods you can call on the window).

window 是保存 Window 实例的全局变量,它代表包含文档的浏览器窗口(通常不是真正的窗口",而是现代中的选项卡浏览器).

window is the global variable holding an instance of Window, it represents the browser window containing your document (not really a "window" usually, rather a tab in modern browsers).

你可以检查一下

window instanceof Window

true

这篇关于Window 和 window 和有什么不一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆