A Final Word

In this column we showed you how to take advantage of JavaScript's object-oriented capabilities using constructors, methods, and prototypes. We started with extending both intrinsic and user-defined classes of objects with the prototype property. We demonstrated this capability with JavaScript's Array and String objects. We then explained you how to use object extension in order to differentiate between instances of the same class, practically giving you two types of objects that inherit their essence from a base class. Finally, we described a true inheritance mechanism, implemented by extending two different objects with a common third one. We used our animation scripts from Column 19 to demonstrate the inheritance concept.