20. Penguins, Properties, and the Prototype



"Oops, try again. Make sure to log the number of legs emperor has!"

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

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

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


The code didn't work yesterday.

Today I entered the page and did no change to the code, but it worked this time.


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