Node.js Flashcards
What is Node.js?
an open-source, asynchronous JavaScript runtime environment built on Chrome’s V8 JavaScript engine, which executes outside the browser
What can Node.js be used for?
build scalable server side network applications
What is a REPL?
a read-eval-print loop is a language shell
When was Node.js created?
2009
What back end languages have you heard of?
PHP, Python, Ruby, Java, C#
What is a CLI?
command line interface, a text-based user interface
What is a GUI?
graphical user interface
Give at least one use case for each of the commands listed in this exercise.
man -read about a command in the manual
cat -combine text files, print out
ls -list contents of a directory
pwd -view current directory
echo -write a string to a text file, command line
touch -create a new text file, updated access stamp on files
mkdir -create a new directory
mv -move a file to another directory, rename files
rm -remove a file from the hard drive
cp -copy a file
What are the three virtues of a great programmer?
laziness, impatience, hubris
What is a computer process?
the instance of a computer program that is being executed by one or more threads
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
~200
Why should a full stack Web developer know that computer processes exist?
a full stack web app is made form multiple processes together
What is the process object in a Node.js program?
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?
access it directly with ‘process’ in Node.js, since it is a global object
What is the data type of process.argv in Node.js?
an array of strings
What is a JavaScript module?
a single JavaScript file
What values are passed into a Node.js module’s local scope?
parameters: exports, require, module, __filename, __dirname
Give two examples of truly global variables in a Node.js program.
clearImmediate(immediateObject)
console
process
What is the purpose of module.exports in a Node.js module?
to export code to be used in another module
How do you import functionality into a Node.js module from another Node.js module?
by calling the require() function (with the argument being a string of the path to the JavaScript file) and assigning the return to a variable
What is the JavaScript Event Loop?
a cycling process for how JavaScript executes code in a non-blocking manner, checks if there is something in the call stack again and again, and if not then checks the callback queue (which is made up of completed web APIs),
-if there is something in the queue, it gets moved to the call stack
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking code waits for each line of code to be resolved in the call stack, while non-blocking code moves code off to a task queue so that the call stack is not blocked from continuing to run