What is wrong with my code?


Putting it all together

Oops, try again. It looks like you have an error in your code. Here's the message: ReferenceError: object is not defined

var snoopy ={
var buddy =new object();
buddy.srecies="golden retriever";


Ignore the first answer I offered. The real issue here is that you need to capitalize "Object".

Incidentally, an alternative approach is to create an object type for dogs and give that object type three properties: name, species, and age. This function is referred to as a "constructor".

function Dog(name, species, age) {
    this.name = name;
    this.species = species;
    this.age = age;

var snoopy = new Dog("snoopy", "Beagle", 10);
var buddy = new Dog("buddy", "Golden Retriever", 5);


This would extend your code to allow for many dog objects to be created. Just another approach.


thank you that is the problem