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]
>
--
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]