20. Penguins, Properties, and the Prototype


#1


https://www.codecademy.com/en/courses/objects-ii/3/5?curriculum_id=506324b3a7dffd00020bf661


I receive the error "...does not properly save the name passed to it."


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

function Emperor(name){
    this.name;
}

Emperor.prototype = new Penguin();

var emperor = new Emperor("OneTwoThree");

console.log(emperor.numLegs);


#2

Should be this.name = name;


#3

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