Yes, thats absolutely right.

One thing I forgot to mention that __proto__ will work only in
Webkit<http://en.wikipedia.org/wiki/WebKit>based browsers.

-Regards
*Amit Agarwal <http:///www.amitagrwal.com>*
+91-779-822-8765



On Thu, Dec 16, 2010 at 12:30 PM, Christophe Eblé
<[email protected]>wrote:

> Amit,
>
> __proto__ is a property of the instance, prototype is a property of
> the constructor function.
>
> So:
>
> newtoy.constructor.prototype.constructor.prototype.constructor.prototype
> = circular reference so it is the prototype Object { rating=3}
> newtoy.__proto__.__proto__.__proto__ = prototype property of the
> instance as stated above (no circular reference so it returns NULL)
>
> Am I right?
>
> Chris
>
> On Thu, Dec 16, 2010 at 7:21 AM, Amit Agarwal <[email protected]> wrote:
>
>
> > Hi,
> >
> > How about people coming up with brain storming questions in Javascript
> which
> > need deep understanding of the language and are little painful to think
> > completely.
> >
> > Here goes my question:
> >
> > function Gadget(name, color){
> >     this.name = name;
> >     this.color = color;
> > }
> >
> > Gadget.prototype.rating = 3;
> >
> > var newtoy = new Gadget('webcam', 'black');
> >
> > 1)
> newtoy.constructor.prototype.constructor.prototype.constructor.prototype
> > = ??
> > 2) newtoy.__proto__.__proto__.__proto__ = ??
> >
> >
> > -Regards
> > Amit Agarwal
> >
> > --
> > To view archived discussions from the original JSMentors Mailman list:
> > http://www.mail-archive.com/[email protected]/
> >
> > To search via a non-Google archive, visit here:
> > http://www.mail-archive.com/[email protected]/
> >
> > To unsubscribe from this group, send email to
> > [email protected]<jsmentors%[email protected]>
> >
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]<jsmentors%[email protected]>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to