Node.js 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.
Takes input, evaluates it, prints output, and goes back to beginning like the console.
When was Node.js created?
2009
What back end languages have you heard of?
Ruby, Python, PHP, C++, JavaScript, C, java, C#
What is a computer process?
A program that is running on your computer. This can be anything from a small background task, such as a spell-checker or system events handler to a full-blown application like Internet Explorer or Microsoft Word. All processes are composed of one or more threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
A lot.
540 on mine.
What is the process object in a Node.js program?
The process object is the global object in Node. It can be accessed from anywhere; it is an instance of EventEmitter. Each Node.js has a set of built-in functionality, accessible through the global process object.
How do you access the process object in a Node.js program?
It is global so you can just type it.
What is the data type of process.argv in Node.js?
Array of strings.
What is a JavaScript module?
In JavaScript, a “module” is a single .js file.
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 and console.
What is the purpose of module.exports in a Node.js module?
To export some code to another Node.js module.
How do you import functionality into a Node.js module from another Node.js module?
const variable = require(file-path)
Ex: const addFunction = require('./add');