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?
A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is 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.
Chrome Dev Tools Console is one
When was Node.js created?
May 2009
What back end languages have you heard of?
Node, Python, PHP, Ruby
What is a computer process?
In computing, a process is 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.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
125
Why should a full stack Web developer know that computer processes exist?
Because Full stack Web development is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary.
This will be extremely important when learning about applications made of multiple components, such as clients, servers, and databases.
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. 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?
Just type process, it is always available Treat it like any other object.
What is the data type of process.argv in Node.js?
Array
What is a JavaScript module?
Module in Node. js is a simple or complex functionality organized in single or multiple JavaScript files which can be reused throughout the Node. js application.
A Module specifically refers to a 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, global
What is the purpose of module.exports in a Node.js module?
It exports a module so other modules can use it
How do you import functionality into a Node.js module from another Node.js module?
Using the require function
What is the JavaScript Event Loop?
looks at stack and task queue, if stack is empty, it takes first task from queue and runs it
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blocking assignment executes “in series” because a blocking assignment blocks execution of the next statement until it completes. … Non-blocking assignment executes in parallel because it describes assignments that all occur at the same time.
What is a directory?
A location for storing files
What is a relative file path?
location relative to where file is
What is an absolute file path?
Full location of file
It starts with a forward slash /
meaning root of file system
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, since there are different sync versions, but fs.writeFile is asynchronous
Asynchronous take callback arguments