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?
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
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
Python, Java, JavaScript, Ruby, C#, and PHP
What is a computer process?
a process is the instance of a computer program that is being executed by one or many threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
hundreds
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, 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.
How do you access the process object in a Node.js program?
1.console.log(process)
2. node process.js
(just type ‘process’)
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 (functions and variables that can be exported)
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.
global, process, console,
What is the purpose of module.exports in a Node.js module?
way to expose things in one module so they’re available in another
How do you import functionality into a Node.js module from another Node.js module?
module.exports = add;
->
const add = require(‘./add’);
What is the JavaScript Event Loop?
mechanism for asynchronous code / deferring code to be executed later
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking: won’t let next ones run until it’s done
non-blocking: lets things run asynchronously so that the rest of the system can keep running things (defers work for later)
What is a directory?
a folder
What is a relative file path?
file within a directory
What is an absolute file path?
full length of the file starting from the root
What module does Node.js include for manipulating the file system?
fs
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?
asynchronous