20/30- what is wrong?


#1


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){
    this.name;}

Emperor.prototype=new Penguin();

var emperor=new Emperor("Emily");
console.log(emperor.numLegs);

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


#2

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;}

#3

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