Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Objects Loop Through Objects Store Objects in Arrays

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

array and objects refer to same variable

The variable questions points to an array or objects. And how about the name, even if we can create an object with the literals, but we still do need a name for them, just like nesting an object inside an object we give that object a key

1 Answer

Steven Parker
Steven Parker
229,670 Points

Individual objects in an array don't need a name, you can access them by indexing the array:

questions[0]  // the first object
questions[1]  // the next object ... etc.