Node.js Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser. Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser. It is primarily focused on creating simple, easy-to-build network clients and servers.
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?
REPL stands for Read-eval-print loop and 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. Devtools/browser console is REPL
When was Node.js created?
2009 by Ryan Dahl
What back end languages have you heard of?
JavaScript, Java, Python, PHP, Ruby, C, C++, sql*, go, rust, swift, assembly, C#
What is a computer process?
d
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
over 300
Why should a full stack Web developer know that computer processes exist?
Full stack Web development is about
What is the process object in a Node.js program?
global variable in node and it gives you information about current Node.js
How do you access the process object in a Node.js program?
use node command for location of node, app name for location of the app or files and then command
What is the data type of process.argv in Node.js?
string
What is a JavaScript module?
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 and process
What is the purpose of module.exports in a Node.js module?
module.exports tells Node.js which codes(functions, objects, strings) to export from a given file so other files can also access the exported code
How do you import functionality into a Node.js module from another Node.js module?
by calling local require() function to import each of the functions defined
What is a directory?
It’s a folder - collection of files
What is a relative file path?
location that is relative to a current directory - (.) for current, (..) for parent
What is an absolute file path?
contains the root element and the complete directory list required to locate the file (/) for
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?
asynchronous and synchronous - they have methods for both - generally asynchronous though