Node.Js Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser. It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What can Node.js be used for?wh
Node.js is used for developing applications that make use of the ability to run JavaScript both on the client as well as on the server side.
ex Real time apps , instant messaging / chat apps, streaming app, social media.
What is a REPL?
read–eval–print loop (REPL) is an interactive shell / computer programming environment that reads user inputs, executes them, and returns the result to the user;
EX: Chrome Browser Console
When was Node.js created?
May 27, 2009 by Ryan Dahl
What back end languages have you heard of?
Scripting Langs - Python, Ruby, PHP, JavaScript, Perl, Elixir
(JIT) - just in time compilation
typescript is a good language to learn after bootcamp.
Memory Managed Langs - Java, C#, Kotlin, Golang, Fortan //These languages are compiled ahead of timt //garbage collection
Manual Memory Management - C++, C, Swift, //ahead of time compiled //low-level
What is the process object in a Node.js program?
The process object is a global object that provides information about, and control over, the current Node.js process.
How do you access the process object in a Node.js program?
since it’s a global object it can accessed from anywhere. It can also be accessed using require():
Example: in the exercise we accessed it using console.log().
What is the data type of process.argv in Node.js?
Array of strings
What is a JavaScript module?
In JavaScript, a “module” is a single .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 - process object
Console - used to print stdout and stderr
Buffer - used to handle binary data
What is the purpose of module.exports in a Node.js module?
Module exports are the instructions that tell Node. js which bits of code (functions, objects, strings, etc.) to export from a given file so that other files are allowed to access the exported code.
How do you import functionality into a Node.js module from another Node.js module?
use the require( ) method. syntax: const varName = require( ' ./filename ' );
What is the JavaScript Event Loop?
looks at the task queue then pushes it onto the stack when the call stack is clear the next thing in the queue gets pushed into the call stack.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking code is anything occupying the call stack. Then we have to wait for it to be cleared.