728x90
Global objects | Node.js v16.15.0 Documentation (nodejs.org)
Global objects | Node.js v16.15.0 Documentation
Global objects# These objects are available in all modules. The following variables may appear to be global but are not. They exist only in the scope of modules, see the module system documentation: The objects listed here are specific to Node.js. There ar
nodejs.org
console.log(global);
브라우저에서는 window가 글로벌 객체이고,
node.js에서는 global 이 글로벌 객체이다.
C:\Users\User\gitprogect\NodeJs> node 1-global/app
<ref *1> Object [global] {
global: [Circular *1],
clearInterval: [Function: clearInterval],
clearTimeout: [Function: clearTimeout],
setInterval: [Function: setInterval],
setTimeout: [Function: setTimeout] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
},
queueMicrotask: [Function: queueMicrotask],
performance: Performance {
nodeTiming: PerformanceNodeTiming {
name: 'node',
entryType: 'node',
startTime: 0,
duration: 82.2766999900341,
nodeStart: 1.1915000081062317,
v8Start: 4.617000013589859,
bootstrapComplete: 58.125800013542175,
environment: 25.251300007104874,
loopStart: -1,
loopExit: -1,
idleTime: 0
},
timeOrigin: 1652455410843.36
},
clearImmediate: [Function: clearImmediate],
setImmediate: [Function: setImmediate] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
}
}
global.hello = () => {
console.log("hello");
};
global.hello(); //hello
hello(); //hello
global.hello = () => {
global.console.log("hello");
};
global.hello(); //hello
hello(); //hello
728x90
'Javascript > Node.js' 카테고리의 다른 글
[Node.js] 클라이언트와 서버의 개념, AWS 클라우드 서버 환경 구축 실습 (0) | 2022.05.14 |
---|---|
[Node.js] 백엔드 개념 기초 영상모음 (0) | 2022.05.14 |
[node.js] 초간단 서버 만들기 (2) Node + Express 웹서버 기본세팅 (0) | 2022.05.14 |
[Node.js] console.log (0) | 2022.05.14 |
node.js 초간단 서버 만들기 (1) express 라이브러리 설치 (0) | 2022.03.18 |