Node.js Flashcards
What is Node.js?
a program that allows JavaScript to be run outside of a web browser
What can Node.js be used for?
commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
read eval print loop; simple interactive computer programming environment that takes single user input, executes them, and returns the result to the user
When was Node.js created?
2009
What is a computer process?
the instance of a computer program that is being executed by one or more threads; execution of tasks
What is the process object in a Node.js program?
a global that provides information about, and control over, the current Node.js process
How do you access the process object in a Node.js program?
its global and can be accessed by name
What is the data type of process.argv in Node.js?
array of strings
What is a JavaScript module?
a single js file
What values are passed into a Node.js module’s local scope?
__dirname, __filename, require, exports, module
Give two examples of truly global variables in a Node.js program.
global and process
What is the purpose of module.exports in a Node.js module?
the instruction that tells Node. js which bits of code (functions, objects, strings, etc.) to “export” from a given file so other files are allowed to access the exported code
How do you import functionality into a Node.js module from another Node.js module?
using require(‘./fileName’) and saving it to a variable
What is the JavaScript Event Loop?
a programming construct or design pattern that waits for and dispatches events or messages in a program
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking is synchronous and must wait for task to be completed until another task can be done; non-blocking is asynchronous and can work on another task while waiting for task#1 to finish