Node.js Flashcards
What is Node.js?
Javascript engine that allows you to run Javascript outside of the browser
What can Node.js be used for?
Used to build network applications (like a server) but also any applications (NASA rover programmed with Node)
What is a REPL?
Read-eval-print loop
A simple interactive programming environment that takes single user inputs, executes them, and returns the result to the user. Basically a little playground environment to learn and test things
When was Node.js created?
2009
What back end languages have you heard of?
PHP, Python, C++, GoLang
What is a computer process?
The instance of a computer program that is being executed by one of many threads. A process contains the program code and its activity.
Why should a full stack Web developer know that computer processes exist?
Our websites, apps, and/or servers will have more than one process occurring so we should know enough about processes to make our projects work correctly.
What is the process object in a Node.js program?
Gives information on whatever the current process running in Node.js is
How do you access the process object in a Node.js program?
Using 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?
Require, exports, module, _dirname, and _filename
Give two examples of truly global variables in a Node.js program.
Process and console
What is the purpose of module.exports in a Node.js module?
To be able to use methods/variables in other JS files
How do you import functionality into a Node.js module from another Node.js module?
When you write the export on the first file you make a variable on the second file that calls the file path with require.
What is the JavaScript Event Loop?
The stack of events, procedures that Java has to run
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blocking executes synchronously. The execution of additional Javascript in the Node.js process must wait until a non-Javascript operation completes.
Non blocking is asynchronous.
What is a directory?
A folder that holds files and folders
What is a relative file path?
The path from the current file to the destination file
What is an absolute file path?
The path from the beginning of the hard drive to whatever the destination file is
What module does Node.js include for manipulating the file system?
Fs (file system module)
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