It's All in the Genes


Excercise 16

Please help. I keep getting this error message but Ican't see what I;m doing wrong. TypeError: Cannot set property 'sayName' of undefined

function Animal (name, numLegs) { = name;
    this.numLegs = numLegs;

// create the sayName method for Animal
Animal.protoype.sayName = function () {
    console.log("Hi my name is " +;

// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);


Spelling error... prototype


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