Node.js Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser. It’s also known as what’s called a runtime environment.
What is a runtime environment?
A runtime environment is an environment in which a program or application can execute or be implemented.
What is a REPL and what does the acronym stand for?
REPL stands for read-eval-print-loop. It’s a simple interactive programming environment that takes single user inputs, executes them, and results to the user.
For example, the console in our browsers is a REPL.
What is blocking in JavaScript?
Blockingis when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes. This is what makes a language synchronous.
What is non-blocking?
Non-blocking is the opposite of blocking where multiple operations can be performed at the same time. This is what makes a language asynchronous.
What is the difference between a library and framework?
Libraries consist of functions that an application can call to perform a task while a framework defines how a developer designs an application.
What is a computer process?
A computer process refers to a set of instructions currently being processed by the computer processor.
For example, if you look at your control panel or activity monitor, you’ll see that you have a lot of processes going on.
What is the process object?
The process object is a global that provides info about, and control over, the current Node.js process. It’s always available to Node.js applications without using require( ).
How do you access the process object in a Node.js program?
By calling the require function with ‘process’ as its argument.
What does process.argv return?
Returns an array of arguments starting at the index 2. Index 1 is the file path of the executable that started the Node process while index 2 is the file path to the JavaScript file being executed.
What is modular programming?
Separating behavior into multiple standalone functions.
What is a module in Node.js?
A module is a single JS file.
What does the require( ) function do?
The built-in function is the easiest way to include modules that exist in separate files. It reads a JavaScript file, executes the file, and then process to return the exports object.
What does Node.js do specifically before a module’s mode is executed when loading modules?
Before a module’s code is executed, Node.js will wrap it with a function wrapper with the module code living in the code block of the function wrapper.
What are the five parameters in a function wrapper before loading another module?
exports, require, module, __filename, __dirname