What is wrong with my code?


#1



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 ={
srecies:"beagle",
age:10
};
var buddy =new object();
buddy.srecies="golden retriever";
buddy.age=5;


#2

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);

console.log(buddy);

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


#3

thank you that is the problem