node modules, require Flashcards

1
Q

What is a JavaScript module?

A

a single js file that has its own scope and can be reused

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, require, module, __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

setInterval, setTimeout, clearInterval, clearTimeout, process, console

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

Allows other modules to access certain variables, functions, etc

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

const moduleName = require(‘./filename’);

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