...

View Full Version : Writing JavaScript classes



bauhsoj
09-21-2005, 06:57 PM
I have seen some JavaScript code written in the form of classes in which methods are added on to an initially defined function's prototype.

This is a very new way of writing JavaScript for me though I would like to understand how this works.

Can anyone explain the in's and out's of this or point me to a few good tutorials on the matter?

I have tried searching Google but mainly turn up information on modifiying the "class" property.

Thanks in advance!

bauhsoj
09-21-2005, 07:39 PM
While browsing the forums in search of something unrelated I stumbled upon these web sites:
http://www.chunkysoup.net/advanced/oojavascript1/
http://www.sitepoint.com/article/oriented-programming-1

This holds the majority of the examples I was looking for, while the two above explain more OO details of JavaScript.
http://www.peterbailey.net/dev/jsclasses/

I am trying to arrive at an understand of JavaScript object-oriented programming from a PHP object-oriented perspective.

Am I mistaken or does the use of the "this" keyword work slightly differently in some manner in JavaScript?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum