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: <nrlz@hotmail.com>
Date: Sun Apr 30 2006 - 19:06:31 CEST

You answered (4) and you are correct! Well done!

Incidentally, this script does require a browser, because it uses the
"alert" function.

Cheer!
Nathar

Michael Winter wrote:
> On 30/04/2006 12:33, nrlz@hotmail.com wrote:
>
> > Try to guess what happens if I run the following code in any modern
> > browser. [...]
>
> A "modern browser" doesn't matter. Any correct ECMAScript implementation
> will do.
>
[snip]
>
> The latter (4). The members array is a property of the prototype object,
> not objects created via the Group constructor function. As each
> resulting object will /share/ the properties of the prototype, any
> properties added to it will accumulate and be accessible to all instances.
>
> [snip]
>
> Mike
>
> --
> Michael Winter
> Prefix subject with [News] before replying by e-mail.
Received on Mon May 1 05:27:58 2006