Node.js Flashcards
What is Node.js?
Node is a program that allows JavaScript to run outside of the web browser.
What can Node.js be used for?
Node can be used to build back end web apps, command line programs.
What is a REPL?
Read Eval Print Loop
What is a computer process?
The instance of a computer program that is being executed by one or many threads.
Why should a full stack Web developer know that computer processes exist?
Full stack development depends on many processes working together to form an app. So understanding what these processes are doing or at least are running is important.
What is the process object in a Node.js program?
It is a global object that has information and control over the current node process.
How do you access the process object in a Node.js program?
Since it’s a global object, you can access it simply by typing process.
What is the data type of process.argv in Node.js?
The data type is an array.
What is a JavaScript module?
A single js file. Each file is a small part of many other modules that come together to be a program.
What values are passed into a Node.js module’s local scope?
__dirname, __filename, exports, module, require.
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?
So that module file knows it is going to be allowing other modules to pair/group up with it.
How do you import functionality into a Node.js module from another Node.js module?
The require method is used in the module that wants to use a functionality thats from another module.
What is the JavaScript Event Loop?
The event loop is how the JavaScript runtime pushes asynchronous callbacks onto the stack once the stack is cleared.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
.
What is a directory?
It is a file that holds all other files.
What is a relative file path?
A relative file path doesn’t have the forward slash.
What is an absolute file path?
An absolute file path starts with the forward slash /
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?
fs.writeFile
Are file operations using the fs module synchronous or asynchronous?
Both depending on which operation is being used.
What is NPM?
NPM allows users to share their js code to others.
What is a package?
A package contains modules that are often small. The package contains a small building block to solve a problem.
How can you create a package.json with npm?
By being in the root directory and then using the command “npm init –yes”