Node Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser.
What can Node.js be used for?
It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
read–eval–print loop
a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.
When was Node.js created?
2009
What back end languages have you heard of?
JavaScript, Java, PHP, Python, Ruby, C#, SQL, C++, C, Rust,
What is a computer process?
The instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.
Why should a full stack Web developer know that computer processes exist?
Full stack Web development is based on making multiple processes work together to form one application
To know what is involved for an application to run
What is the ‘process’ object in a Node.js program?
A ‘global’ that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using ‘require()’.
How do you access the ‘process’ object in a Node.js program?
It’s global, it’s there and you can always access it?
What is the data type of ‘process.argv’ in Node.js?
Array of strings
What is a JavaScript module?
A single ‘.js’ file; The important part is 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.
process and global
What is the purpose of ‘module.exports’ in a Node.js module?
Pick and choose what is available to other modules
To export functionality from one Node.js module to another Node.js module.
How do you import functionality into a Node.js module from another Node.js module?
require function
const add = require(‘./add’);
What is the JavaScript Event Loop?
Look at call stack and task/callback queue, if stack empty, pushes first task/callback queue to call stack.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking: code that is slow, on browser, prevents any other action while code is running.
non-blocking: asynchronous callbacks, it is run later?
What is a directory?
A file system structure containing files and other directories; groups files together
What is a relative file path?
location that is relative to current directory
path to file within same directory: file name
What is an absolute file path?
contains the root element and the complete directory list to the file
path to file from the root directory to file name
What module does Node.js include for manipulating the file system?
fs module
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 forms