forked from learning-zone/nodejs-basics
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathglobal-objects.js
More file actions
37 lines (33 loc) · 869 Bytes
/
global-objects.js
File metadata and controls
37 lines (33 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* ------------------
* Global Objects
* ------------------
*
* __dirname()
* __filename()
* clearTimeout(timeoutObject)
* console()
* exports()
* global()
* module()
* Process()
* require()
* setTimeout(callback, delay[, ...args])
* TextDecoder()
* TextEncoder()
* URL()
*
* */
//----------------------
// reqiure() Object
//----------------------
var path = require("path");
console.log(`Rock on world from ${path.basename(__filename)}`); // Rock on world from global-objects.js
const jsonData = require('./assets/file.json');
console.log(jsonData);
//-------------------------
// dirname() & filename()
//-------------------------
console.log(`Current directory: ${__dirname}`);
console.log(`Current directory: ${path.dirname(__filename)}`);
console.log(`Current file: ${__filename}`);