Prototypes and Classes Flashcards Preview

Web Development > Prototypes and Classes > Flashcards

Flashcards in Prototypes and Classes Deck (16)
Loading 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.

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().

3
Q

Prototypes allow developers to delegate ________ to other objects.

A

Prototypes allow developers to delegate behaviours to other objects.

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.

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)

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.

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.

8
Q

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

A

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

9
Q

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

A

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

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.

11
Q

______ are very flexible and have no class hierarchy.

A

Mixins are very flexible and have no class hierarchy.

12
Q

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

A

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

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.

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.

15
Q

We use promises for __________ behaviour.

A

We use promises for asynchronous behaviour.

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.