19/30 Black Magic

// the original Animal class and sayName method
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();

var penguin = new Penguin();

Why when it prints it says undefined?


Sorry I can't help you. I'm just replying so it goes back to the top as nobody has answered you yet


Thanks dude,
Got it done.


I've done it right but it hasn't printed out anything to the console :frowning: