Node Flashcards

1
Q

What is a JavaScript module?

A

A file

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

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

A

exports, module, require, filename, dirname

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

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

A

process, console, global

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

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

A

to expose to other modules

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

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

A

calling a required() to pull the exports from the other file

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

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

A

fs module

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

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

A

fs module

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

Are file operations using the fs module synchronous or asynchronous?

A

both

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

What does the express.json() middleware do and when would you need it?

A

parses json when you want to receive json from clients

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