Override Inherited Methods

Tell us what’s happening:

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;

// Add your code below this line

Penguin.prototype.fly = function(){
    return "Alas, this is a flightless bird";
};

// Add your code above this line

let penguin = new Penguin();
console.log(penguin.fly());

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods

You have an unecessary semi-colon after your overridden function line (just after the closing curly brace). Remove and retry the submit.

Not working !
Having a problem!

The instructions are:

Override the fly() method for Penguin so that it returns “Alas, this is a flightless bird.”

but your method is:

Penguin.prototype.fly = function(){
    return "Alas, this is a flightless bird";
};

Note the punctuation in the string. Computers are very picky and exact.