NODE Flashcards

(31 cards)

1
Q

What is Node.js?

A

Node.js is a program that allows JavaScript to be run outside of a web browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What can Node.js be used for?

A

It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform. Making web servers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a REPL?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When was Node.js created?

A

May 27, 2009

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What back end languages have you heard of?

A

Python, JavaScript, C++, Ruby, PhP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a computer process?

A

Any running program on computer

the instance of a computer program that is being executed by one or many threads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

135

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why should a full stack Web developer know that computer processes exist?

A

Full stack Web development is based on making multiple processes work together to form one application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the process object in a Node.js program?

A

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()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you access the process object in a Node.js program?

A

console.log(process)

In terminal, use node nameOfFile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the data type of process.argv in Node.js?

A

Array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a JavaScript module?

A

A javascript file containing code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What values are passed into a Node.js module’s local scope?

A

exports, require, module, __filename, __dirname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Give two examples of truly global variables in a Node.js program.

A

Process, console, setInterval, setTimeout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of module.exports in a Node.js module?

A

To be able to separate functions into their own file and make it easier to use in other files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you import functionality into a Node.js module from another Node.js module?

A

require() function to import each of the functions defined

17
Q

What is the JavaScript Event Loop?

A

concurrency model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.

Runs everything in stack, checks queue, pushes everything from stack, keep looping

18
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

Code that is blocked/slow will prevent other code from being executed.

Non Blocked code/asynchronous code will run multiple code at the same time
19
Q

What is a directory?

20
Q

What is a relative file path?

A

Relative path is a path relative to the current page’s path location

21
Q

What is an absolute file path?

A

a path that starts from the root of the Drive to the destination

22
Q

What module does Node.js include for manipulating the file system?

A

File system module

23
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile()

24
Q

Are file operations using the fs module synchronous or asynchronous?

A

Asynchronous (does multiple codes at once)

25
What is NPM?
Node Package Manager. npm is the world's largest software registry. use npm to share and borrow packages
26
What is a package?
A directory with one or more files within. Reusable code compiled within a directory
27
How can you create a package.json with npm?
npm init --yes or npm init -y
28
What is a dependency and how do you add one to a package?
A dependency is another package that your package needs in order to work. Include the dependency after npm install
29
What happens when you add a dependency to a package with npm?
Downloads file and
30
How do you add express to your package dependencies?
Npm install express
31
What Express application method starts the server and binds it to a network PORT?
Listen method