Node Flashcards
What is Node.js?
An environment that allows you to execute javascript code without a browser needed
What can Node.js be used for?
Building servers without blocking code
What is a REPL?
Read-eval-print-loop
a simple programming environment that takes and runs user input, and returns the result, one line at a time
When was Node.js created?
May 2009
What back end languages have you heard of?
Python, Ruby, PHP, JavaScript, C#/.Net, C++ (online game servers)
What is the process object in a Node.js program?
The process object is 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?
By using the process variable name
What is the data type of process.argv in Node.js?
an array
What is a JavaScript module?
a .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.
console, process
What is the purpose of module.exports in a Node.js module?
To be able to use functions and values between modules
How do you import functionality into a Node.js module from another Node.js module?
require(./name)
What is the JavaScript Event Loop?
Facilitates the order of operations for asynchronous code by monitoring the callback queue and the call stack
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Synchronous and asynchronous
Blocking code prevents other operations from occurring
Non-blocking code can run in the background while other operations take place
What is a directory?
a folder, or a group of files
What is a relative file path?
directions to a target file from the current location
What is an absolute file path?
The complete path to a target file, beginning from the root directory/drive
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()
Are file operations using the fs module synchronous or asynchronous?
asynchronous