This forum is now read-only. Please use our new forums! Go to forums

0 points
almost 10 years

the answer to 18/30

function Animal(name, numLegs) { this.name = name; this.numLegs = numLegs; } Animal.prototype.sayName = function() { console.log(“Hi my name is “+this.name); };

// define a Penguin class function Penguin (name) { this.name = name; this.numLegs = 2; }

// set its prototype to be a new instance of Animal Penguin.prototype = new Animal();