Global Object:
- Global: Always use VaR to define variables to avoid introducing global variables;
- Process: The content of all global execution contexts is in the Process object;
Module System:Three global variables
- Require (): If the module is not in node_modules, the relative path must be used for import;
- Exports: Some attributes can be defined on this object. APIs exposed using this object as a module;
- Module: exports is module. Exports. you can completely overwrite exports and change it to an exposed API;
Listener event:Eventemitter; comparison window. addeventlisten;
VaR eventemitter = require ('events '). eventemitter; // obtain the listener method corresponding to the import module; var A = new eventemitter; // create an object based on this method;. on ('event', function () {});/. once ('event', function () {}); // listens to related events on this object
Node basics-Global