Node/Express/Fetch Flashcards
What is Node.js?
Node.js is a program that allows JS to be run outside of a web browser.
What can Node.js be used for?
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?
read-eval-print loop. 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. browser console is REPL.
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
Scripting Languages: These are interpreted on-the-fly
jit - just in time compilation
JavaScript (jit), Ruby (jit), Elixir, PHP, Python, Perl, Erlang
what to learn after BootCamp: TYPESCRIPT, any other languages job rec.
Memory Managed Languages: These languages are compiled ahead of time
Java/Kotlin, C#, Golang, Haskell, Julia, F#, Fortan
Manual Memory Management: ahead of time compiled (low-level language)
C++, C, Swift, Rust, D, Zig
SQL - for Database
What is the process object in a Node.js program?
The process object in Node. js 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?
execute the node command with the js file that has the console.log(process); in it… or maybe process
What is the data type of process.argv in Node.js?
an array of strings.
What is a JavaScript module?
A single JS file.
A file containing related code. technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
What values are passed into a Node.js module’s local scope?
exports (object), require (function), module (object), __filename (string), __dirname (string)
Give two examples of truly global variables in a Node.js program.
console, process, global
What is the purpose of module.exports in a Node.js module?
The main purpose of module. exports is to achieve modular programming. Modular programming refers to separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
How do you import functionality into a Node.js module from another Node.js module?
call the require function and get the relative path as argument and assign it to a variable.
What is the JavaScript Event Loop?
responsible for collecting the event and running when the stack is empty. event loop looks at the task queue and pushes it back to stack when stack is empty (call stack is cleared).
look at stack and look at the task queue, if stack is empty, it takes the first thing on the queue and pushes it on to the stack ONCE everything on the stack is cleared. which effectively runs it. stacks up on task queue(s) / call back queue and pushes it back to stack to be run.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking: synchronous. need to wait for a process to finish before the next line of code runs. it blocks the next code to run until the current is finished. blocking is occupying the call stack so it can’t do anything until it’s cleared. anything occupying the call stack is blocking.
non-blocking: asynchronous callbacks. is able to run other code/thing while it’s running one code/thing.