20 Penguins, Properties and the Prototype


#1

My code is the following but it isn't working. This is the text of the error: "Oops, try again. Make sure to log the number of legs emperor has!"

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("Mr. Emperor Penguino");
console.log(emperor.numLegs);

I don't see the mistake. Please help :slightly_smiling:


#2

I saw what my mistake was: I put a dot in the name of my new emperor object. After removing it I passed the lesson.