<sectionid="description"> En las lecciones anteriores, aprendió que un objeto puede heredar su comportamiento (métodos) de otro objeto clonando su objeto <code>prototype</code> : <blockquote> ChildObject.prototype = Object.create (ParentObject.prototype); </blockquote> Luego, <code>ChildObject</code> recibió sus propios métodos encadenándolos a su <code>prototype</code> : <blockquote> ChildObject.prototype.methodName = function () {...}; </blockquote> Es posible anular un método heredado. Se realiza de la misma manera: agregando un método a <code>ChildObject.prototype</code> utilizando el mismo nombre de método que el que se anula. Aquí hay un ejemplo de <code>Bird</code> anula el método <code>eat()</code> heredado de <code>Animal</code> : <blockquote> función animal () {} <br> Animal.prototype.eat = function () { <br> devuelve "nom nom nom"; <br> }; <br> función Bird () {} <br><br> // Heredar todos los métodos de Animal <br> Bird.prototype = Object.create (Animal.prototype); <br><br> // Bird.eat () anula Animal.eat () <br> Bird.prototype.eat = function () { <br> devuelve "peck peck peck"; <br> }; </blockquote> Si tienes una instancia, <code>let duck = new Bird();</code> y llamas a <code>duck.eat()</code> , así es como JavaScript busca el método en <code>duck's</code> cadena de <code>prototype</code><code>duck's</code> : 1. pato => ¿Se define eat () aquí? No. 2. Pájaro => ¿Se define comer () aquí? => Sí. Ejecutarlo y dejar de buscar. 3. Animal => eat () también está definido, pero JavaScript dejó de buscar antes de alcanzar este nivel. 4. Objeto => JavaScript dejó de buscar antes de alcanzar este nivel. </section>
<sectionid="instructions"> Reemplace el método <code>fly()</code> de <code>Penguin</code> para que devuelva "¡Ay !, este es un pájaro que no vuela". </section>
testString: 'assert(penguin.fly() === "Alas, this is a flightless bird.", "<code>penguin.fly()</code> should return the string "Alas, this is a flightless bird."");'
- text: El método <code>bird.fly()</code> debería devolver "Estoy volando!"
testString: 'assert((new Bird()).fly() === "I am flying!", "The <code>bird.fly()</code> method should return "I am flying!"");'
```
</section>
## Challenge Seed
<sectionid='challengeSeed'>
<divid='js-seed'>
```js
function Bird() { }
Bird.prototype.fly = function() { return "I am flying!"; };