Javascript中的GLOBAL变量是什么? [英] What is the GLOBAL variable in Javascript?
问题描述
此代码:
https://github.com/bjornharrtell /jsts/blob/master/index.js
引用一个名为GLOBAL的变量。
$ b
ReferenceError:GLOBAL未定义
$ b 当我在浏览器中执行此操作时,出现错误消息: $ b
这个GLOBAL来自哪里,为什么没有定义?
在Node.js中, code> GLOBAL 是全局对象的别名(通常称为 global
)。
在浏览器中,它不存在。
< Browserify会识别
全局
别名,并将注入对窗口
的引用,但不会识别 GLOBAL
。 它已更改为全局
四年前
This code: https://github.com/bjornharrtell/jsts/blob/master/index.js
refers to a variable named "GLOBAL".
When I run this in a browser, I get an error message:
"ReferenceError: GLOBAL is not defined"
Where does this GLOBAL come from, and why is it not defined?
In Node.js, GLOBAL
is an alias to the global object (more commonly referred to as global
).
In browsers, it doesn't exist.
Browserify recognizes the global
alias, and will inject a reference to window
, but does not recognize GLOBAL
.
It was changed to global
four years ago
这篇关于Javascript中的GLOBAL变量是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!