--- id: 587d7db1367417b2b2512b86 title: Reset an Inherited Constructor Property challengeType: 1 videoUrl: '' localeTitle: إعادة تعيين منشئ Conherrated الخاصية --- ## Description
عندما يرث كائن prototype الخاص به من كائن آخر ، فإنه يرث أيضًا خاصية مُنشئ supertype . إليك مثال على ذلك:
وظيفة الطيور () {}
Bird.prototype = Object.create (Animal.prototype)؛
السماح بطة = الطيور الجديدة () ؛
duck.constructor // وظيفة الحيوان () {...}
ولكن يجب أن تظهر duck وجميع حالات Bird التي شيدت من قبل Bird وليس Animal . للقيام بذلك، يمكنك تعيين يدويا Bird's الملكية منشئ إلى Bird وجوه:
Bird.prototype.constructor = Bird؛
duck.constructor // function Bird () {...}
## Instructions
إصلاح التعليمات البرمجية بحيث duck.constructor و beagle.constructor إرجاع beagle.constructor الخاصة بهم.
## Tests
```yml tests: - text: يجب أن يكون Bird.prototype مثالًا Animal . testString: 'assert(Animal.prototype.isPrototypeOf(Bird.prototype), "Bird.prototype should be an instance of Animal.");' - text: يجب أن يعود duck.constructor Bird . testString: 'assert(duck.constructor === Bird, "duck.constructor should return Bird.");' - text: يجب أن يكون Dog.prototype مثالا Animal . testString: 'assert(Animal.prototype.isPrototypeOf(Dog.prototype), "Dog.prototype should be an instance of Animal.");' - text: يجب أن يعود beagle.constructor 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 ```