20/30 What's wrong in this code?


#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(); // notice no arguments

var emperor = new Penguin("penpen");

emperor.numLegs;

What's the bad of this? The results I'm getting 2.


#2

console.log(emperor.numLegs);


#3

It went well in the code.
Thank you very much. :smile:


#4

Oh, I get my problem now. XD I kept misspelling emperor! So that's why I always ended up with right results but it was saying I didn't properly define 'Emperor'! :laughing: