Node JS Flashcards
What is Node.js?
It is a JavaScript environment that allows you to run JavaScript outside of a browser
What can Node.js be used for?
It can be used to run server applications, run command lines, program robots, etc.
What is a REPL?
Stands for Read-Eval-Print-Loop, and refers to a computer programming environment where user inputs are taken one line at a time, executed, and returned; a language shell
When was Node.js created?
2009
What is a computer process?
An instance of a computer program that is being executed; a “task” in the task manager
Why should a full stack Web developer know that computer processes exist?
We will be working with computer processes that appear in our “stack”
What is the process object in a Node.js program?
An object representing the current Node.js process that is being run
How do you access the process object in a Node.js program?
Using the variable process
What is the data type of process.argv in Node.js?
array
What is a JavaScript module?
An individual .js file
What values are passed into a Node.js module’s local scope?
exports, require, module, __filename, __dirname
Give two examples of truly global variables in a Node.js program.
process, global
What is the purpose of module.exports in a Node.js module?
It allows other files to import objects from the module
How do you import functionality into a Node.js module from another Node.js module?
Using the require function require(‘relativeUrl.js’)
What is a directory?
A location that stores files and other directories
What is an absolute file path?
A file path starting with the root directory; starts with /
What is a relative file path?
A file path that does not start with /, referring to a file based on it’s location relative to the current working directory
What module does Node.js include for manipulating the file system?
fs
What method is available in the Node.js fs module for writing data to a file?
.writeFile(file, data, callback)
Are file operations using the fs module synchronous or asynchronous?
asynchronous