i removed the line
__proto__ : personProto

from both the object jane and tarzan, and i added

Object.getPrototypeOf(jane) = personProto;
Object.getPrototypeOf(tarzan) = personProto;

but still at line
jane.describe();
i gives an error that "Object doesn't support this property or method"

On Nov 16, 12:15 pm, Anoop Gupta <[email protected]> wrote:
> _prop_  property is deprecated and should not be used in new code: use
> Object.getPrototypeOf<https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/...>
> instead.
> Anyways this code is working.
> tried it onhttp://jsfiddle.net/anoop/HfsKC/
>
> -AG
>
>
>
>
>
>
>
>
>
> On Wed, Nov 16, 2011 at 12:07 PM, Rahul <[email protected]> wrote:
> > (function(){
>
> >        var personProto = {
> >                describe : function(){
> >                         alert("NAME IS "+this.name);
> >                }
> >        };
>
> >        var jane = {
> >                name : "JANE",
> >                __proto__ : personProto
> >        };
>
> >        var tarzan = {
> >                name : "TARZAN",
> >                __proto__ : personProto
> >        };
>
> >        jane.describe();
>
> > })();
>
> > in the above code for the last line i am getting an error "Object
> > doesn't support this property or method",
>
> > But what i am expecting is object "jane" must inherit method describe
> > from object "personProto"
>
> > can anyone please help me out
>
> > --
> > 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]
>
> --
> Regards
> Anoop K. Gupta

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