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 can be used to build back ends for Web applications, command-line programs, or any kind of automation.
What is a REPL?
Read-eval-print loop
a simple computer programing environment that takes single user inputs, executes them, and returns the result to the user.
When was Node.js created?
It was created May 27, 2009
What back end languages have you heard of?
Python,
Java
JavaScript
What is the process object in a Node.js program
Gives control over current Node process and data model
How do you access the process object in a Node.js program?
call it! or require() it
What is the data type of process.argv in Node.js?
an array of strings
What is a JavaScript module?
A module is a 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
process object
console object
What is the purpose of module.exports in a Node.js module?
The purpose of module.exports is to allow the functionality defined in modules within other modules.
How do you import functionality into a Node.js module from another Node.js module?
you use the require function and pass in the file you want to import as a string argument and assign that to a variable
require(‘./add’)
What is the JavaScript Event Loop?
It monitors the queue and pushes the first thing on it onto the call stack as soon as it’s clear
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking is “slow” code, nothing else can be done with blocking code
if something is occupying the call stack, it is blocking
asynchronous is non blocking