Re: Variables and Object creation using prototypes
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Variables and Object creation using prototypes

From: Matt Kruse <newsgroups@mattkruse.com>
Date: Sun Apr 30 2006 - 16:01:32 CEST

nrlz@hotmail.com wrote:
> function Group() {
> }

function Group() {
  this.members = [];
}

This might cause it to behave more like you'd expect. This way, the
'members' variable belongs to each instantiated Group object, rather than to
the shared prototype.

-- 
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Received on Mon May 1 05:27:53 2006