Link Details

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
  • 1215
  • 340

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.