Object-Oriented JavaScript: Using the `Prototype` Property
(Page 1 of 4 )
In this second part of this series, Alejandro Gervasio shows the correct implementation of the "Prototype" property, and how to use it to apply inheritance to many objects of the same family type.
Introduction
Here we are again. Welcome to the second part of the series “Object-oriented JavaScript.” As you know, this series goes through the implementation of user-defined objects in JavaScript, explaining the key points and introducing some advanced concepts. These concepts range from how to use Inheritance in multiple objects to developing real-world examples.
In the first tutorial, I went over the basics of creating user-defined objects, and established the guidelines for understanding how static properties and methods can be assigned to them. In addition to setting up some hands-on examples, handy for illustrating the process for instantiating objects and utilizing their methods, I scratched the surface of some lesser-known topics, such as “Function” objects and the “constructor” property. Although these rather unusual aspects of object-oriented JavaScript certainly won’t cause a considerable impact on the way you develop your client-side applications, it’s worth having at least a basic grounding on how they can be used.
Now, paying attention to this second part of the series, I’ll be showing, through easy-to-understand examples, the correct implementation of the “prototype” property, and its usefulness for applying Inheritance to many objects of the same family type. By the end of this article, you should have a better idea of how all these features fit together, and hopefully, you’ll be provided with the required knowledge for creating child objects, which will inherit some properties from base objects.
Having drawn the general guidelines for this tutorial, it’s time to leap forward and learn more about user-defined objects in JavaScript. Let’s get started.
Next: Prototyping objects: looking at the “prototype” property >>
More JavaScript Articles
More By Alejandro Gervasio