JavaScript
  Home arrow JavaScript arrow Object-Oriented JavaScript: Using the `Pro...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Object-Oriented JavaScript: Using the `Prototype` Property
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 34
    2005-12-05

    Table of Contents:
  • Object-Oriented JavaScript: Using the `Prototype` Property
  • Prototyping objects: looking at the “prototype” property
  • Object interaction in JavaScript: applying Inheritance through the “prototype” property
  • Traversing object properties: using the “for in” loop structure

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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.

    More JavaScript Articles
    More By Alejandro Gervasio


       · This second tutorial explores the specific use of the "prototype" property, in order...
       · Great tutorial, it explains the prototype property very well!
       · Thank you for your positive commments on my article. I truly appreciate that and...
       · Its really a great article, but it does not explains the mechanics of constructors...
       · Thank you for commenting on my JavaScript article. With regard to your first...
       · After struggeling with many arcane explanations I found your example demonstrated...
       · Hi Stephen,Thank you for the kind comments on my JavaScript article, and I’m...
       · Thanks Alejandro Gervasio.This is the wonderful article beautifully explaining...
       · Thanks for the compliments. Glad to know my article has been useful for you.
     

    JAVASCRIPT ARTICLES

    - Google Ajax APIs: Building a Navigation Bar ...
    - Easing jQuery Plug-in: Using the easeOutBack...
    - jQuery Easing Plug-in: Building a Navigation...
    - Easing jQuery Plug-In: Fixing Access Issues ...
    - Easing jQuery Plug-in: Implementing the Beha...
    - jQuery Easing Plug-in: Building an Animated ...
    - Dynamic Drop-down Menus: Javascript Progress...
    - Creating Drop-down Menus Using Progressive E...
    - Building Slide Shows Using Progressive Enhan...
    - Form Validation with Progressive Enhancement...
    - Validating Web Forms: an Introduction to Pro...
    - Ajax Progressive Enhancement: Reading Remote...
    - Ajax Image Requests: Progresive Enhancement ...
    - jQuery Image Gallery: Working with Progressi...
    - Progressive Enhancement in an Image Gallery







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek