20. Penguin Properties and prototypes


what am i doing wrong?

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

Replace this line with your 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;
    Emperor.prototype = new Penguin();

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



Emperor.prototype = new Penguin();

needs to happen outside your Emperor class deceleration.

prototype extends a class, this needs to happen after the class deceleration.


Thanks :slight_smile:


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