Penguins, Properties, and the Prototype


Penguins, Properties, and the Prototype

The code is not working the message i receive is:

Oops, try again. Make sure to properly define the Emperor constructor!

Replace this line with your code. 
function Penguin(name) { = name;
    this.numLegs = 2;

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

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



When creating a class that inherits from a parent, we write it,

SubClass.prototype = new ParentClass();


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