LFZ Node Quiz Flashcards
What is Node.js?
a PROGRAM THAT RUNS JAVASCRIPT OUTSIDE OF A BROWSER
What can Node.js be used for?
Pretty much everything
What is a REPL?
A read–eval–print loop
When was Node.js created?
2009
What back end languages have you heard of?
python, c++, ruby, c, php, java, c#, javascript
What is a computer process?
An instance of a computer program that is being executed
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
~6
Why should a full stack Web developer know that computer processes exist?
To check resources
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?
with process
What is the data type of process.argv in Node.js?
array
What is a JavaScript module?
A single 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, TextEncoder
What is the purpose of module.exports in a Node.js module?
To specify what functions to export
How do you import functionality into a Node.js module from another Node.js module?
Use the require function and assign it to a variable or use it right away
What is the JavaScript Event Loop?
Checks the stack if its empty, and pushes the next task in queue to the stack
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking prevents the stack from moving. Synchronous is blocking as each process runs until completion on the stack. non-blocking goes through the event loop
What is a directory?
A folder that allows us to group files together
What is a relative file path?
the route to the path from the folder you are currently in/ the file is currently in
What is an absolute file path?
The route to the path from the root
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?
asynchronous