Skip to content

Clean JavaScript inheritance

by saski on January 26th, 2010

  • Clean JavaScript inheritance

    Object extending in JavaScript is done with the prototype property, and in most cases simple prototype reassignment is sufficient for creating classes. But when you are developing a more complex application, you code quickly becomes ugly, because the syntax for creating prototypal chains is definitely not friendly.

    All popular frameworks, except jQuery have their own way of creating classes, but personally, I think that they sometimes use unnatural and unnecessary code to achieve this. For example, here is the way how using prototypejs you are meant to call a super class method:

  • This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

    No comments yet

    Leave a Reply

    Note: XHTML is allowed. Your email address will never be published.

    Subscribe to this comment feed via RSS