node.js Flashcards
- What is Node.js?
Node.js is an asynchronous event-driven JavaScript runtime (this just means Asynchronous programming), Node.js is designed to build scalable network applications.
It is a program that allows JavaScript to be run outside of a web browser.
- What can Node.js be used for?
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 is a REPL?
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. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages.
- When was Node.js created?
2009
- What back end languages have you heard of?
Ruby, Python, PHP, SQL (technically a database language), Java, C#, C++, fortan(sort of), C, kotlin, golang, JavaScript, swift(technically… used for ios), perl…
- What is the process object in a Node.js program?
The process object is a global that provides information about, and control over, the current Node.js process.
As a global, it is always available to Node.js applications without using require().
It can also be explicitly accessed using require():
const process = require(‘process’);
- What is the data type of process.argv in Node.js?
Array
- What is a JavaScript module?
a. It is a SINGLE JS FILE - Tim
- What values are passed into a Node.js module’s local scope?
a. The five parameters — exports, require, module, __filename, __dirname are available inside each module in Node.
- Give two examples of truly global variables in a Node.js program.
b. global / console / command to run terminal / process / class: Buffer-
- What is the purpose of module.exports in a Node.js module?
a. If you want to make anything available to your node.js program, you attach it to the export property. - Tim
- How do you import functionality into a Node.js module from another Node.js module?
a. To include functions defined in another file in Node.js, import the module by using the require keyword at the top of the file.
b. The result of require is then stored in a variable which is used to invoke the functions using the dot notation.
- What is a directory?
a. File systems typically have directories (also called folders) which allow users to group files into separate collections.
- What is a relative file path?
b. Relative File Path: It describes the path of the file relative to the location of the current web page file.
i. Example 1: It shows the path of the file present in the same folder of the current web page file.
ii. A path to a file from where you CURRENTLY are (current directory to the file).
- What is an absolute file path?
a. Absolute File Paths: It describes the full address(URL) to access an internet file.
i. An absolute path starts with just a ‘/’ slash.
ii. root always starts with slash
b. Absolute URLs will take you to a different domain name on the web.