I am just starting to learn prototype inheritance in JS and I would like the child object (def2) of my subclass object to inherit from superclass object's child object (def). The following code will explain what I mean:
function Animal(name)
{
this.name = name;
this.def = {
FieldA: 'aaa',
FieldB: 'bbb'
}
}
function Rabbit(name, category)
{
Animal.apply(this, arguments);
this.def2 = { };
this.def2.prototype = Animal.def;
alert(this.def2.FieldA); // this is undefined
}