Tell us what’s happening:
I do not understand what is the reason why I cannot override the method fly of Bird.
I am trying to override it by making a new method in Penguin.
Your code so far
function Bird() { }
Bird.prototype.fly = function() { return "I am flying!"; };
function Penguin() { }
Penguin.prototype = Object.create(Bird.prototype);
Penguin.prototype.constructor = Penguin;
// Only change code below this line
Penguin.prototype.fly=function (){
return"Alas, this is a flightless bird";
};
// Only change code above this line
let penguin = new Penguin();
console.log(penguin.fly());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36
.
Challenge: Override Inherited Methods
Link to the challenge: