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
Use a for...in loop to access each key (or property name) in an object.
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
Hi again, there are lots of similarities
between arrays and objects.
0:00
Mainly they both provide a way
to store multiple values.
0:00
Arrays store each value in a specific
numeric position called an index, and
0:03
objects store multiple values that can be
accessed using a key or property name.
0:07
Because array elements have numeric index,
a for
0:12
loop is one quick way to access
each element in the array.
0:15
To access data that's inside an object,
0:17
you use a special type of
loop called a for in loop.
0:20
For in iterates or loops over each key or
property name in the object.
0:25
The structure looks like this.
0:29
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