Object-Oriented Javascript and Prototypal Inheritance Flashcards

1
Q

What is inheritance?

A

When one object gets access to the properties and methods of another object.

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

What is classical inheritance?

A

It’s the way it’s been done for a long time - in C#, etc. But it’s very verbose,

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

What is prototypal inheritance?

A

It is simple. It’s flexible, inheritable and extendable.

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

What does reflection mean?

A

It means that an object can look at itself, listing and changing its properties and methods.

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

What does this code return and why?

A

‘For in’ loops go through each property of an object in the same way a for loop can use length on an array. But, in this case it also went up to the prototype to get the function getFullName().

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

What does this code return and why?

A

Because we’re using the hasOwnProperty method, this time the for in loop will only go through the immediate properties of its own object and not include the prototype’s properties.

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