Node Flashcards
What is Node.js?
-Asynchronous event-driven JavaScript runtime
What can Node.js be used for?
-Build scalable network applications
What is a REPL?
-Read-eval-print loop
When was Node.js created?
-Node.js was initially released on May 27, 2009
What back end languages have you heard of?
-C, C++, Java, Ruby, PHP, Python
What is a computer process?
-Process is the instance of a computer program that is being executed by one or many threads
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
-120
Why should a full stack Web developer know that computer processes exist?
-Full stack development is based on making multiple processes work together to form one appliation
What is the process object in a Node.js program?
-global that provides information about, and control over, the currnet Node.js process
How do you access the process object in a Node.js program?
-process.argv
What is the data type of process.argv in Node.js?
-array
What is a JavaScript module?
-Each js file is treated as a module
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.
- process
- global
What is the purpose of module.exports in a Node.js module?
-Tells Node.js which bits of code to export from a given file so other modules have access to the exported code
How do you import functionality into a Node.js module from another Node.js module?
-require()
What is the JavaScript Event Loop?
-If the stack is empty, it takes the first item on the queue and pushes to the stack
What is different between “blocking” and “non-blocking” with respect to how code is executed?
-Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn’t block execution
What is a directory?
-Location for storing files on computers
What is a relative file path?
-A relative path needs to be combined with another path in order to access a file
What is an absolute file path?
-An absolute path always contains the root element and the complete directory list required to locate the file
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 asynchronous and synchronous