I passed with a reference error


All I want to know is "Why do I get a reference error?"

// create your Animal class here
function Animal(name, numLegs) {
    this.name = name;
    this.numLegs = numLegs;
// create the sayName method for Animal
Animal.prototype.sayName = function() {
    console.log("Captain Cook");

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

Here's what is logging to my console.

Captain Cook
ReferenceError: numLegs is not defined



when I type this into the code I pass but I get a reference error


Where's the problem with my code?


please delete this topic as it is a duplicate !!


I can't delete as the fact that i'm not a moderator


you can delete as you are the owner....


How wold I delete it then? here's what I see with my extra stuff tab


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