JavaScript Inheritance

Over the past few weeks, I’ve been doing a lot of reading into how JavaScript inheritance actually works. I’ve known for some time that objects in JavaScript inherit from this magical thing called “prototype” but I never fully understood what was really happening under-the-hood.

With more than nine million Google search results for the phrase “javascript prototype inheritence” you would think that it would be easy to find an explanation that was both (1) easy to understand and (2) technically correct. In this case, you’d be wrong.

Douglas Crockford has an explanation which is technically correct but uses examples which aren’t very clear (in my opinion). Wikipedia has a nice generic explanation of prototypal inheritance, but it’s not JavaScript specific and has no technical examples.

After a good deal of searching I found a blog post by Sergio Pereira that was far and away the best article I read. While technically spot-on, Sergio’s diagrams and example code set his post apart from every other article I’ve read. I highly suggest subscribing to his RSS feed as Sergio also has a host of other great JavaScript tips.

Share and Enjoy:
  • RSS
  • Facebook
  • StumbleUpon
  • Digg
  • Sphinn
  • Technorati
  • Reddit
  • LinkedIn
  • Twitter
  • Tumblr

About Arthur Kay

Arthur Kay is a long-time nerd and JavaScript enthusiast. He lives in the Chicago suburbs and is active in the local web development community. Arthur currently works for Sencha, Inc. as a Solutions Engineer. The thoughts, ideas, and opinions expressed on this website are Arthur's alone and do not represent his employer.
This entry was posted in JavaScript, Web Development. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>