Node.js Flashcards
What is Node.js?
A program that allows JavaScript to be ran outside of the web browser.
What can Node.js be used for?
It is used to build back ends for web apps, command-line programs, or any kind of automation.
What is REPL?
Read-Evaluate-Print Loop
- Known as interactive toplevel or language shell
- Interactive computer programming environment that takes single user inputs, executes it, and returns the result to user
When was Node.js created?
Node.js was created in May 27, 2009 by Ryan Dahl
What back end languages have you heard of?
Node.js, React.js, MongoDB, Angular, Spring Boot
What is a computer process?
When a computer program gets executed by one or many computer threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
555 Processes
Why should a full stack Web developer know that computer processes exist?
Full stack needs all three processes (front-end, back-end, and data storage) need to be working in order for web apps to work
What is the process object in a Node.js program?
A global that provides info and control over the current Node.js process.
How do you access the process object in a Node.js program?
Can call process whenever since it’s global
What is the data type of process.argv in Node.js?
An array
What is a JavaScript module?
A single .js file.
What values are passed into a Node.js module’s local scope?
An object
Give two examples of truly global variables in a Node.js program.
process
console
What is the typeof and value of exports?
object
{ }
What is the typeof and value of require?
function Module { id: '.', path: '/absolute/path/to', exports: {}, parent: null, filename: '/absolute/path/to/entry.js', loaded: false, children: [], paths: [ '/absolute/path/to/node_modules', '/absolute/path/node_modules', '/absolute/node_modules', '/node_modules' ] }
What is the typeof and value of module?
object
Module { id: , path: , exports: { }, filename: , loaded: , children: [ ], paths: [ ], }
What is the typeof and value of __filename?
string
directory/directory/fileName
What is the typeof and value of __dirname?
string
directory/directory/directoryName
What is the purpose of module.exports in a Node.js module?
To import a specific function from a different .js file into the main .js file.
How do you import functionality into a Node.js module from another Node.js module?
const functionName = require(./fileName);
What is a directory?
A folder that holds files denoted by a /
What is a relative file path?
A relative file path is a portion of the file path, typically when file paths are in the same root directory
What is an absolute file path?
The full directory with all of its children/grandchildren/etc
Starts with a /