Prototypes and Classes Flashcards

1
Q

Prototypal inheritance is a feature in JavaScript that allows us to make use of _______ from other ______. Usually these are related but they do not have to be.

A

Prototypal inheritance is a feature in JavaScript that allows us to make use of code from other objects. Usually these are related but they do not have to be.

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

Give some examples of prototypal inheritance:

A

For example, an animal object may possess a name and speak() function. A dog object may possess a licksPerSecond property. A bird object may possess knownWords:[], and fly().

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

Prototypes allow developers to delegate ________ to other objects.

A

Prototypes allow developers to delegate behaviours to other objects.

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

If we have an object that needs functionality from another object, we can create _______ ________ in their own objects and the ________ chain will still remain intact.

A

If we have an object that needs functionality from another object, we can create unique properties in their own objects and the prototype chain will still remain intact.

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

Constructors help developers make multiple similar ______ with the same ______ and _______. (Object.create and Object.assign perform similar functionality)

A

Constructors help developers make multiple similar objects with the same properties and methods. (Object.create and Object.assign perform similar functionality)

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

With call(), an object can use a ________ belonging to another object.

A

With call(), an object can use a method belonging to another object.

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

In classical inheritance, A class is like a ______— a description of the _____ to be created.

A

In classical inheritance, A class is like a blueprint — a description of the object to be created.

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

Classes inherit from classes and create subclass relationships: _______ class taxonomies.

A

Classes inherit from classes and create subclass relationships: hierarchical class taxonomies.

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

_________ isn’t delegated, it is inherited in a stricter hierarchy.

A

Functionality isn’t delegated, it is inherited in a stricter hierarchy.

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

Using ______.assign(), we can simply allow any object to use functionality from another.

A

Using Object.assign(), we can simply allow any object to use functionality from another.

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

______ are very flexible and have no class hierarchy.

A

Mixins are very flexible and have no class hierarchy.

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

Developers can assign multiple objects to any other _____ or _____.

A

Developers can assign multiple objects to any other object or prototype.

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

The _____ object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.

A

The Promise object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.

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

A “_______” callback function and a “____” callback function may be executed when the operations completes.

A

A “resolved” callback function and a “reject” callback function may be executed when the operations completes.

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

We use promises for __________ behaviour.

A

We use promises for asynchronous behaviour.

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

A promise can be in one of three states:
1)
2)
3)

A

A promise can be in one of three states:

1) pending (has not yet resolved or rejected).
2) fulfilled (completed and successfully resolved).
3) rejected (completed but has not successfully resolved). Do not confuse this with an error although you may reject a promised based on an error.