Node.js Flashcards
[Command Line]
What is a CLI?
Command line interface - interface for commands
[Command Line]
What is GUI?
graphical user interface - applications meant for consumers (end users)
[Node intro]
What is Node.js?
A program that allows JavaScript to be run outside of a web browser used to build back ends for Web applications, command-line programs or any kind of automation that developers wish to perform.
[Node Intro]
What can Node.js be used for?
To build scalable network applications, using JavaScript in back-end
[Node Intro]
What is a REPL?
Read-Eval-Print-Loop
Reads input, evaluates, prints the output, waits for next input (loop)
[Node Intro]
When was Node.js created?
May 27, 2009
[Node Intro]
What back end languages have you heard of?
Scripting Languages (interpreted): Python, JavaScript, Ruby, PHP, Perl
Compiled Languages: C, C++, Go, haskell, crystal, rust, SQL* (databases)
Partially Compiled: Java (jvm), Scala (jvm), Clojure (jvm), Kotlin (jvm), C# (.net clr), F# (.net clr), visual basic
[Node Process Argv]
What is the process object in a Node.js program?
It gives information and control over the current node.js process.
[Node Process Argv]
How do you access the process object in a Node.js program?
use require() or
call the process variable because it’s global
[Node Process Argv]
What is the data type of process.argv in Node.js?
An array of strings containing all arguments passed when command was launched
[Node Module System]
What is a JavaScript module?
Separate JavaScript files for different specific functionalities, that can work together with other files (modules).
[Node Module System]
What values are passed into a Node.js module’s local scope?
__dirname
__filename
exports
module
require()
[Node Module System]
Give two examples of truly global variables in a Node.js program.
process
console
setInterval() /clearInterval()
setTimeOut() / clearTimeOut()
[Node Require]
What is the purpose of module.exports in a Node.js module?
So that modules can share functionalities between files.
[Node Require]
How do you import functionality into a Node.js module from another Node.js module?
require(‘relativePathURL’);
example: require(‘./filename.js’);
[Node the Event Loop]
What is the JavaScript Event Loop?
The event loop monitors the call stack, when the call stack is empty it checks the if queue is empty. If there is something in the queue, it will push it to the call stack.
[Node the Event Loop]
What is the difference between ‘blocking’ and ‘non-blocking’ with respect to how code is executed?
Blocking is if something is currently occupying the call stack, it is blocking until it is finished. If something is being executed off the call stack, it is non-blocking. When it’s done, then it event loop pushes it to the call stack.
[Node fs Readfile]
What is a directory?
a ‘folder’ or location which points to other directories or files
[Node fs Readfile]
What is a relative file path?
A path pointing to another local file (from where we currently are)
[Node fs Readfile]
What is an absolute file path?
Points to a file starting from the root
[Node fs Readfile]
What module does Node.js include for manipulating the file system?
fs module
[Node fs Writefile]
What method is available in the Node.js ‘fs’ module for writing data to a file?
.writeFile()
[Node fs Writefile]
Are file operations using the fs module synchronous or asynchronous?
both, there are forms for both
for blocking, use sync method
for non-blocking, remove sync
[Webpack-intro]
What is Webpack?
module bundler
looks at entry file and all required files and bundles them