node.js Flashcards

1
Q

What is Node.js?

A

An asynchronous way for us to run javascript on something other than the 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 allows us to use JavaScript as the back end language of our applications

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

What is a REPL?

A

read–eval–print loop (REPL)

Takes in the input of a user, evaluated it, and prints it to the CLI

Similar to the console in a browser

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

If you want to execute a JaveScript file, how do you do that?

A

Run the following command:

node file.js

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

When was Node.js created?

A

2009

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

What back-end languages have you heard of?

A
PHP
Python
Rubyman
Pearl
JaveScript
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a computer process?

A

An instance of a computer program being executed in one or more threads.

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

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

A

About 176, including windows and background apps

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

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

A

We need to know which processes will be user side and server-side

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

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

A

A global object of the process itself

Much like the window is an implicit object in your HTML, a process is an implicit object in your JS file

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

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

A

You console.log(process) in your code, and just run the code with node.js

Exp: node process.js

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

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

A

It is an array for strings

The first is the pathway to your node program, followed by the pathway of the JS file being run, followed by the arguments the user inserted when running the script with node

node echo.js ‘why do I need node to echo something?’
[
‘/usr/bin/node’,
‘/mnt/c/Users/user/repos/c0521-code-solutions/node-process-argv/echo.js’,
‘why do I need node to echo something?’
]

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

What is a JavaScript module?

A

An individual .js file being used in node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
Q

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

A

process

global

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