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. It is free, open-source software and its source code is available on GitHub.
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.
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
C++, Python, Java, C# (.net is a framework for C#), Ruby, PHP, Go, Perl, JavaScript/Node
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. As a global, it is always available to Node.js applications without using require( ). It can also be explicitly accessed using require( ):
const process = require(‘process’);
How do you access the process object in a Node.js program?
const process = require(‘process’);
And by typing ‘process’ because it is a global variable
What is the data type of process.argv in Node.js?
An array
What is a JavaScript module?
In JavaScript, a “module” is a single .js file. Node.js supports modules using a system heavily influenced by CommonJS. Most non-trivial Node.js programs are made of many, many modules. Authors of Node.js programs strive to separate their code into modules that each provide a small chunk of functionality. The program as a whole is the result of all of these modules working together in concert.
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.
clearImmediate(immediateObject)
clearInterval(intervalObject)
clearTimeout(timeoutObject)
console
global
process
What is the purpose of module.exports in a Node.js module?
import functionality into a node.js module from another node.js module
How do you import functionality into a Node.js module from another Node.js module?
module.exports = (name of function you want to export)
require(‘./name of file you want to import’) in the receiving file
What is a directory?
An organizational structure to store files as a group. A directory is a location for storing files on your computer. Directories are found in a hierarchical file system, such as Linux, MS-DOS, OS/2, and Unix.
What is a relative file path?
A relative path refers to a location that is relative to a current directory. Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy.