Penguins, Properties, and the Prototype - Issue


#1

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

// create your Emperor class here and make it inherit from Penguin
function Emperor(name) {
this.name = name;
}
Emperor.prototype = new Penguin();

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

Here is my code. Every time I run it, it errors: Oops, try again. Make sure to log the number of legs emperor has!. I'm not sure what is wrong with the code. Any suggestions?


#2

The code looks correct, and passes when I tested it. Cannot reproduce the error in FF. Try to refresh the page and submit again.


#3

I refreshed the browser and it worked. Must be a bug or something.


#4

Thanks for bringing up this issue. I had the same problem, came to the Q&A Forum and refreshed as mtf suggested. This 'refreshing the page' solution helped me out too!