9. Assessing Properties, part 2! Please Help


#1


this isnt working for some reason and i cant figure out why!

// Take a look at our next example object, a dog
var dog = {
species: "greyhound",
weight: 60,
age: 4
};

var species = dog["species"];
// fill in the code to save the weight and age using bracket notation
{
var weight = dog["weight"],
var age = dog["age"];
};


syntax error: unexpected token var


Replace this line with your code.


#2

@fieryguitarist,
You are using a comma operator in the wrong place

Have a close look at

var weight = dog["weight"],


#3

And why are there curly braces?


#4

@fieryguitarist,
The curly-brackets-{ } are used as code-block indicators....
Have a read
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block

As you are using

 {
var weight = dog["weight"];
var age = dog["age"];
} //<== NO semicolon-; required

it is useless....


#5

Thank You So Much. I Appreciate It. I was kind of confused. lol, just a simple mistake like that can mess up your entire code.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.