node-module-system Flashcards
What is a JavaScript module?
a way to organize and reuse code, to encapsulate specific functionality in a single unit, called a module, which can then be imported and used in other parts of your code.
What values are passed into a Node.js module’s local scope?
exports: This is an object that is used to export values and functionality from the module, making them available to other modules that import it.
require: This is a function that is used to import other modules and access their exports.
module: This is an object that represents the current module and provides information about it, such as its filename and the exports object.
__filename: This is a global variable that contains the absolute path of the current module’s file.
__dirname: This is a global variable that contains the absolute path of the directory that the current module is located in.
Give two examples of truly global variables in a Node.js program.
process … console