[Javascript] object methods and prototypes

Chris T christ at saeweb.com
Thu Apr 29 13:25:32 CDT 2004


I think it's all a matter of preference here. I may be wrong though. But I'm
pretty sure that's the case in ActionScript and AS is very similar to JS.

Chris Tifer

----- Original Message ----- 
From: "Mike Dougherty" <mdougherty at pbp.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Thursday, April 29, 2004 10:08 AM
Subject: [Javascript] object methods and prototypes


Is it better to define an object with method references in the constructor
or to assign methods
using the object.prototype syntax?  (are more resources used for multiple
instantiations of
example 1?)

Assume MyFunction() is already defined earlier:

ex 1:
function MyObj() {
   /* code here */
   this.Method = MyFunction()
   }

ex 2:
function MyObj() {
   /* code here */
   }

   MyObj.prototype.Method = MyFunction()
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list