Penguins, Properties, and the Prototype


#1

MY CODE:

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("Alvis");

console.log(emperor.numLegs);

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

NO IDEA WHAT'S WRONG. ANY HELP?


#2

Your code is fine. Refresh the site and clear Cache i think that should help.


#3

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