20/30- what is wrong?


it says that the constructor does not properly save the name passed to it. What does this mean?

// create your Emperor class here and make it inherit from Penguin
function Emperor(name){

Emperor.prototype=new Penguin();

var emperor=new Emperor("Emily");

// create an "emperor" object and print the number of legs it has


This means that you will get an undefined if you try this console.log( emperor.name );

And why you get an undefined? Cause emperor has no name assigned.

Try this

function Emperor(name){
    this.name = name;}


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