Penguins, Properties, and the Prototype


#1

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

// create an "emperor" object and print the number of legs it has
Emperor.prototype= new Penguin();
var emperor= new Emperor("YAWWW")
console.log("Hi I have "+ emperor.numLegs + " " + "legs");

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

What's wrong?


#2

console.log(emperor.numLegs);

Code is good. You just need to print the number of legs emperor has.


#3

This worked.Cant believe I have been blind to the instructions. Thanks man.