HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

You'll see the difference you make! Login and vote now.
Link 23226 thumbnail
User 222611 avatar

By dansim
via javascriptkata.com
Published: May 23 2007 / 16:54

There are hundreds of ways to do inheritance in javascript but a single one is simpler, cleanier and prettier than all the other ones.
  • 12
  • 3
  • 1517
  • 0

Comments

Add your comment
User 229927 avatar

tbanes replied ago:

0 votes Vote down Vote up Reply

Javascript doesn't really have any classes, per se, and this method of "inheritence" does not correspond to classical inheritence.

See some of Douglas Crockford's stuff for more details.

User 220134 avatar

madarco replied ago:

0 votes Vote down Vote up Reply

I think the best way to do OOP in Javascript is Haxe. Not only for the "class foo { ... }" syntax, but also for the type inference.

User 217073 avatar

Honkin_Liar replied ago:

1 votes Vote down Vote up Reply

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.