Now give it blue, since Facebook is blue.
And we'll print it out again for the screen.
So now we have ceo fav color and first name.
And just like I set the properties with a dot notation,
I could certainly get at the property with a dot notation.
So for example, let me do another console.log and I could say that,
let's say company CEO name is and
put a space and I'll do string cognition and I'll say company.ceo.firstName,
okay and we'll put a semicolon at the end.
And we're kind of going off the border here.
So when we will just JavaScript is very liberal with spaces so we'll just do that.
And when we save it, we can see it now says, Company CEO name is Mark.
So the JavaScript engine traversed the object's company and
went to the CEO property, which is also an object.
And then, went and retrieved the first name property.
Now the dot notation is not the only way for me to get at the properties.
I could also do the following.
I could say consoles go in the console.log.
Console.log and what we'll do this time is we're going to use the bracket notation,
so we'll say company and we'll say bracket name, and
name will be in quotation marks because now we're getting at the property name.
And the name is a string.
And go ahead and output that.
So you see now it's getting to be Facebook.
So I can get at the company name using the bracket notation,
not just the dot notation.
Now why does there two notations here?
Why can't I just use the dot notation?
Well the reason I can't always use the dot notation, is because the dot notation will
only work with whatever is a valid JavaScript identifier, or
valid JavaScript, either function name, or valid JavaScript variable name.
So for example, if I wanted to say, that company.$stock.
And remember dollar sign is something JavaScript variables,
identifiers and function names are allowed to start with.
And I'll say stock = 110.
Let's say that's how much it is.
And I'll go ahead and do console.log and console open up company and
we'll output that.
You can see that the stock property got set to 110.
But what if I wanted to be kind of, you know, very dramatic.
I don't want to just say stock.
I want to say stock of company.
And put spaces in here.
I can't really do that, I can't really do that either.
That wouldn't work either.
However what work is,
instead of the dot notation, I'll put it in the brackets notation.
And when I do that and save it, you'll see that our
property's now named stock with a dollar sign of company.
And we could probably remove the dollar sign now.
That was only for the effect of the variable name.
So now if we look we have stock of company and that is the name of our property.
So I can now go and retrieve the stock price by saying, okay, stock