Penguins, Properties, and the Prototype


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

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

Emperor.prototype = new Penguin();

var emperor = new Emperor();

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


I dont really understand why it doesnt log in emperor numLegs???


A link to the lesson could help, but I found something:

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

Should there be a numLegs parameter?



The only difference between our code was that I named emperor


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