Node Flashcards
What is Node.js?
Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser. It is primarily focused on creating simple, easy-to-build network clients and servers.
What can Node.js be used for?
Node.js is designed to build scalable network applications for the back-end.
What is a REPL?
A read–eval–print loop (REPL), also 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.
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
Python, C, C++, , C#, Java, Ruby, PHP, Golang, JavaScript
What is the process object in a Node.js program?
The process object is a global variable that provides information about, and control over, the current Node.js process.
How do you access the process object in a Node.js program?
As a global, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require()
What is the data type of process.argv in Node.js?
An array of strings
What is a JavaScript module?
A module in JavaScript is just a file containing related code. In JavaScript, we use the import and export keywords to share and receive functionalities respectively across different modules. The export keyword is used to make a variable, function, class or object accessible to other modules.
A module is a single JS File.
What values are passed into a Node.js module’s local scope?
The five values are exports, require, module, __filename, __dirname. All are available inside each module in Node.
although these parameters are global to the code within a module, they are local to the module (see documentation for module wrapper).
Give two examples of truly global variables in a Node.js program.
- process
2. console
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?
Call the local require() function and assign it to a variable
ex. const add = require('./add');
What is the JavaScript Event Loop?
Watches the task queue and the call stack. When the call stack is clear, the next thing in the task queue is pushed into the call stack.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blocking: The browser cannot do anything when there is blocking in the call stack. Anything that is occupying the call stack is blocking.
Non-Blocking: Allows the browser to continue the call stack even when the browser is processing code.