Quiz 2 Flashcards

1
Q

What is a promise?

A

An object that will be completed in the future

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

In a JavaScript class, how do you declare a getter function for a field called “stuff” so that the function can be called on an instance, obj, by writing “obj.stuff”?

A

get stuff

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

Suppose you call a function that requires a callback with two parameters, err and data. When the callback completes, which of the following possibilities should NOT occur?

A

Err and data are both populated – indicating that the function encountered an error but still was able to return some of the data

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

What is the name of the tool that creates HTML pages from JavaScript comments?

A

Jsdoc

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

In a JavaScript class, where should the “exports” object be declared?

A

After the class body

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

What is the node command to install the dependencies listed in the package.json file?

A

Npm install

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

The keyword await is used to?

A

Wait for a Promise to resolve

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

When a Promise resolves, it is in one of two possible states. Those two states are called?

A

Fulfilled / rejected

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

What will happen if you call a function that returns a Promise and you forget to use await?

A

The program will hang indefinitely

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

In a JavaScript class, how do you declare a field called “stuff” so that it is private?

A

stuff

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