Inheriting from Constructor's Prototype Object
This section provides a quick description of how object inheriting properties and methods from its constructor's prototype object. A tutorial example and diagram is provided to show relations of an object, its constructor, and the constructor's prototype object.
From previous chapters in this book, we learned that:
To demonstrate those rules, I wrote the following tutorial example to allow "myBook" to inherit the "price" property from the constructor's prototype object:
The output of this tutorial example confirms what we learned earlier:
The output can also be represented with this diagram:
Table of Contents