首页 > 如何理解下面关于variable scope的英文句子?

如何理解下面关于variable scope的英文句子?

Your global variables (or functions) can overwrite window variables (or functions).
Any function, including the window object, can overwrite your global variables and functions.


说白了,在浏览器里,window 就是个存放全局变量的对象,window.x 等同于全局变量 x,所以会相互覆盖。

这个做法和 Lua 的 _G 一样。

【热门文章】
【热门文章】