Node Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser.
It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform. Node.js is powered by V8; the same JavaScript engine in the Google Chrome browser.
What can Node.js be used for?
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
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 by Ryan Dahl
What back end languages have you heard of?
Ruby, PHP, Java, . Net, and Python
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)?
A lot
Why should a full stack Web developer know that computer processes exist?
What is the process object in a Node.js program?
The process object is a global that provides information about, the current Node.js process
How do you access the process object in a Node.js program?
global and provides information about, and control over, the current Node.js process.
It can also be explicitly accessed using require()
const process = require(‘process’);
What is the data type of process.argv in Node.js?
an array
What is a JavaScript module?
It’s a single .js 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 object,
setInterval
process
global
What is the purpose of module.exports in a Node.js module?
to achieve modular programming. Modular programming refers to separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
How do you import functionality into a Node.js module from another Node.js module?
const add = require(‘./add’);
What is the JavaScript Event Loop?
a constantly running process that monitors both the callback queue and the call stack
What is different between “blocking” and “non-blocking” with respect to how code is executed?
A blocking assignment takes effect immediately it is processed. A nonblocking assignment takes place at the end of processing the current “time delta”
What is a directory?
file system cataloging structure, folder
What is a relative file path?
the hierarchical path that locates a file or folder on a file system starting from the current directory. relative from current directory
What is an absolute file path?
locates the file or folder starting from the root of the file system.
What module does Node.js include for manipulating the file system?
What method is available in the Node.js fs module for writing data to a file?
writeFile()
Are file operations using the fs module synchronous or asynchronous?
asynchronous