Node.js Flashcards
What is Node.js?
an asynchronous event-driven JavaScript runtime
What can Node.js be used for?
run JavaScript outside of a web browser to build applications.
What is a REPL?
read-eval-print loop
a computer programming environment that takes user inputs, executes them, and returns the result.
When was Node.js created?
Initial release was May 2009
What back-end languages have you heard of?
Scripting Language (often interpreted) JavaScript Ruby Python PHP Perl
Compiled Language C# Java Go Haskell typescript
Questions I have:
What is a runtime?
- all of the stuff that surrounds your program that you didn’t write
What is a thread?
- what the cpu uses as a spot to pick up where it left off in running a program
What is dead-locking?
- when two threads are relying on each other to finish in order to execute the next step
What is a computer process?
a process is the instance of a running computer program.
While a computer program is a passive collection of instructions typically stored in a file on disk, a process is the execution of those instructions after being loaded from the disk into memory.
Roughly how many computer processes are running on your host operating system? (activity monitor)
628 processes
com.docker.hyperkit is using the most CPU
What is the “process” object in a Node.js program?
the process object is a global object that can be accessed inside any module without requiring it.
How do you access the “process” object in a Node.js program?
Since it is global you can just use its name like a variable that has already been defined
What is the data type of process.argv in Node.js?
array of strings
What is the 3 tierd structure of full stack web development?
Front end process
Back end process
Data process (at least one)
What is a JavaScript Module?
it is a single .js file.
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 these modules working together in concert.
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
global
What is the idea behind modular programming?
decompose a solution to a large problem into many smaller solutions to sub-problems
What is the purpose of module.exports in a Node.js module?
to tell which bits of code to export from a given file so other files are allowed to access the exported code.
How do you import functionality into a Node.js module from another Node.js module?
call the require function and pass in the relative file path of the module needed
What is the JS event loop?
it is a way of understanding how code is executed from the stack, collecting and processing events, and executing queued sub-tasks
What is different between “blocking” and “non-blocking” with respect to how code is executed?
non-blocking code is asynchronous code that is being executed while other code can be executed
blocking code is synchronous code that is being executed and not allowing other code to execute. Blocking code is on top of the call stack.
What are the 4 concepts that set JS apart from other languages?
Prototypal Inheritance
how “this” works
closures
event loop
What is a directory?
Is a special file that holds files
What is a relative file path?
path that locates a file starting from the current directory
What is an absolute file path?
a path from the root directory and the complete directory list required to locate the file
starts with a /