It's just the way Javascript works.  The internal [[Prototype]] property of
an object, used for property lookup, is not the same thing as a property
that happens to have the name "prototype".
In your example, the [[Prototype]] of c is the property named prototype on
its constructor function, and not the property named prototype on c itself.

As Mads says, you can set c's prototype using __proto__ or else set it (for
all objects created using the child constructor) as the constructor
function's prototype as in your commented out code.

On Wed, Nov 5, 2008 at 4:28 PM, Anthony Shipman <[EMAIL PROTECTED]> wrote:

>
> On Thu, 6 Nov 2008 02:19:06 am Mads Sig Ager wrote:
> > Hi Anthony,
> >
> > if you want to modify the prototype of an existing object, you are
> > looking for the __proto__ accessor:
> >
> > c.__proto__ = p;
> >
> > Assigning to 'prototype' just creates a normal property called
> > 'prototype' but does not change the prototype chain.
> >
> > -- Mads
>
> Is this standard Javascript or a quirk of the V8 implementation?
>
> --
> Anthony Shipman                    Mamas don't let your babies
> [EMAIL PROTECTED]                   grow up to be outsourced.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to