11/33 - I don't understand what I am missing here


#1

So I feel like I have this...but I'm being told I am missing a colon after the property id...

var snoopy = {
    snoopy.species: "beagle",
    snoopy.age: 10
};
var buddy = new Object();
buddy.species = "golden retriever";
buddy.age = 5;
}

I am also being told it's my syntax..what am I missing here?


#2

I'm not sure about that rogue ending bracket you have there

var snoopy = {
    snoopy.species: "beagle",
    snoopy.age: 10
};
var buddy = new Object();
buddy.species = "golden retriever";
buddy.age = 5;
} //This last bracket is useless!!

#3

Thank you! I have been fidgeting a lot with the code. However, I am still getting the same message without it.

It currently is going in as:

var snoopy = {
snoopy.species:"beagle",
snoopy.age:10
};

var buddy = new Object();
buddy.species = "golden retriever";
buddy.age = 5;

#4

Solved it... So I needed to take away the dot notation under snoopy.

var snoopy = {
    species: "beagle",
    age: 10
    };
    
var buddy = new Object();
    buddy.species = "golden retriever";
    buddy.age = 5;

Would I be able to call a property from snoopy, using dot notation?


#5

Yes indeed you can. This exercise is just to show you that you can effect an object either in or out of the object. So if you wanted to add the 'snoopy' object, and at the end of your code (or your class), you could effectively change anything in that object simply by using dot notation, or utilize it's value. There's an endless amount of possibilities for an Objects uses.

It's best to utilize the Object for declaration statements to make your code more readable, and for the reader to understand the point of the class more thoroughly, but for everything else DOT notation is more useful!