Penguins, Properties, and the Prototype


I couldn't find any mistakes in my code as bellow in terms of showing the number of legs, I also checked out someone's post that was the same as the problem, but I can't still figure out any errors from my code. Does anyone suggest ? Thanks :smile:

function Penguin(name) { = name;
this.numLegs = 2;

function Emperor(name) { = name;
// this.numLegs = 2;

// create your Emperor class here and make it inherit from Penguin
Emperor.prototype = new Penguin();

// create an "emperor" object and print the number of legs it has
var emperor = new Emperor("Penguin");
var legs = emperor.numLegs;


ERROR: Oops, try again. Make sure to log the number of legs emperor has!



Your code is correct....
++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser


Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


You're right, just refreshing my broswer, thanks