Saturday, September 12, 2020

What is Global In Node JS

Node.js global objects are global in nature and available in all modules. You don't need to include these objects in your application; rather they can be used directly. These objects are modules, functions, strings and object etc. Some of these objects aren't actually in the global scope but in the module scope.

A list of Node.js global objects are given below:

__dirname

__filename

Console

Process

Buffer

setImmediate(callback[, arg][, ...])

setInterval(callback, delay[, arg][, ...])

setTimeout(callback, delay[, arg][, ...])

clearImmediate(immediateObject)

clearInterval(intervalObject)

clearTimeout(timeoutObject)

Node.js __dirname

It is a string. It specifies the name of the directory that currently contains the code.


references:

https://www.javatpoint.com/nodejs-global-objects#:~:text=js%20Global%20Objects-,Node.,functions%2C%20strings%20and%20object%20etc.

No comments:

Post a Comment