Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Objects!
You have completed JavaScript Objects!
Preview
Learn how to access and use an object's data in your program.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
One difference is that arrays use a number
or index value to access an array element,
0:00
while objects use a key, or
property name to access a property.
0:04
For example,
if you had an array named students,
0:09
you'd get to the first element using
an index value of 0, like this.
0:12
Let's look at an example student object
with the properties name and age.
0:16
There are two different ways to
access the value inside an object.
0:21
First, you can access the value
of the name property like this.
0:24
You use the same type of square
brackets you use with an array, but
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up