Tag: prototypal inheritance

V8 / JS运行时:JavaScript窗口函数如何在没有前缀“window”的情况下使用

我不太了解JS控制台,但是我正在进入命令行编程,在开始使用外部程序的shell / node之前,最好先了解我的本地环境 我的猜测是所有的命令行语句都是with (window) eval(/* whatever user typed before hitting enter/*)来调用的with (window) eval(/* whatever user typed before hitting enter/*)但是这看起来很糟糕。 上下文肯定绑定为“窗口”,如果我console.log(this)但我不知道为什么/如何 这几乎就像用户cd到窗口对象中,将其设置为上下文