Putting It All Together 11/33. STUCK!


#1

first the literal notation

var snoopy = {
breed = "beagle",
age = 10

};

now for the constructor notation

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

I keep getting an Syntax error, and I don't know why! :frowning:


#2

In literal notation you use : like this:

var obj = {
    key:value,
    anotherKey:anotherValue,
    ...
}

#3

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

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

Just some weird syntax rules here. Sometimes comma, sometimes semi-colon, etc.