What Is The Global Variable In Javascript?
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: G
Solution 1:
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 globalfour years ago
Solution 2:
Global variable came from the implementation of javascript in nodeJS
You can see it as Windows object for implementation of javascript in a web browser
Solution 3:
The code you are looking at is designed to run in a Node.JS environment.
The GLOBAL variable is documented in the node manual.
It is a feature provided by the Node environment and not a core part of JavaScript.
Post a Comment for "What Is The Global Variable In Javascript?"