20/30 Properly define Emporor in constructor


#1

So I don't know whats wrong here, it seems pretty simple, It prints the answer, but I get an error message. Thanks

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

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

// create an "emperor" object and print the number of legs it has
Emporor.prototype= new Penguin();
var emporor= new Emporor("Chris");
console.log(emporor.numLegs);


#2

@jhoove4

Have a close look at your emperor

Emporor


#4

Thanks. I caught that after I posted it. D'oh!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.