It's All in the Genes - Won't Print


#1


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


When I "Save & Submit Code" the lesson prompts as complete, but nothing gets printed. I really don't like moving on feeling like I cheated the system somehow. Any tips here are welcome!


// 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("Hi my name is " + this.name);
};

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


#2

Same code prints in an incognito window. Might be a bug or maybe some browser cache issue.


#3

I have the exact same code and it prints but I get an error message saying "It looks like your Animal.prototype.sayName method does not properly log to the console 'Hi my name is [name]' where [name] is the name of the Animal". I think it's a bug but there's no link to report a bug on this excercise


#5

Your code is perfect, if it still doesn't want to print then try refreshing the web page.
I hope this helped.


#6

// 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("Hi my name is " + this.name);
};

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

the semicolon is the problem,...


#7

Thanks everyone I got it!


#9