--- id: 587d7db1367417b2b2512b86 title: Reset an Inherited Constructor Property challengeType: 1 videoUrl: '' localeTitle: Restablecer una propiedad de constructor heredada --- ## Description
Cuando un objeto hereda su prototype de otro objeto, sino que también hereda el supertype propiedad constructor 's. Aquí hay un ejemplo:
función Bird () {}
Bird.prototype = Object.create (Animal.prototype);
dejar pato = nuevo pájaro ();
duck.constructor // function Animal () {...}
Pero el duck y todos los casos de Bird deberían mostrar que fueron construidos por Bird y no por Animal . Para hacerlo, puedes establecer manualmente Bird's propiedad Bird's constructor de Bird objeto Bird :
Bird.prototype.constructor = Bird;
duck.constructor // function Bird () {...}
## Instructions
duck.constructor el código para que duck.constructor y beagle.constructor devuelvan sus respectivos constructores.
## Tests
```yml tests: - text: Bird.prototype debe ser una instancia de Animal . testString: 'assert(Animal.prototype.isPrototypeOf(Bird.prototype), "Bird.prototype should be an instance of Animal.");' - text: duck.constructor debe devolver Bird . testString: 'assert(duck.constructor === Bird, "duck.constructor should return Bird.");' - text: Dog.prototype debe ser una instancia de Animal . testString: 'assert(Animal.prototype.isPrototypeOf(Dog.prototype), "Dog.prototype should be an instance of Animal.");' - text: beagle.constructor debe devolver el Dog . testString: 'assert(beagle.constructor === Dog, "beagle.constructor should return Dog.");' ```
## Challenge Seed
```js function Animal() { } function Bird() { } function Dog() { } Bird.prototype = Object.create(Animal.prototype); Dog.prototype = Object.create(Animal.prototype); // Add your code below this line let duck = new Bird(); let beagle = new Dog(); ```
## Solution
```js // solution required ```