Object-Oriented Javascript and Prototypal Inheritance Flashcards
What is inheritance?
When one object gets access to the properties and methods of another object.
What is classical inheritance?
It’s the way it’s been done for a long time - in C#, etc. But it’s very verbose,
What is prototypal inheritance?
It is simple. It’s flexible, inheritable and extendable.
What does reflection mean?
It means that an object can look at itself, listing and changing its properties and methods.
What does this code return and why?
‘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().
What does this code return and why?
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.