20/30 Penguins, Properties, and the Prototype


#1

hi,

i cant see what i am missing, ive compared it to others and they all seem the same as mine??

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

// create an "emperor" object and print the number of legs it has
Emperor.prototype = new Penguin();

var Emperor = new Emperor ("Aaron");

console.log(emperor.numLegs);
`


#2

HI this line

var Emperor = new Emperor ("Aaron");

you object should be named emperor instaed of Emperor


#3

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