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 Loops, Arrays and Objects Tracking Data Using Objects Mixing and Matching Arrays and Objects

So let me see if I understand this correctly. This is still an array so we need to write questions[i] but because ....

it contains 3 objects, we need to use dot notation to access the object "property". So you write questions[i].question to access that object within the array but could have also written, questions[i]["question"] ?

1 Answer

andren
andren
28,558 Points

Your understanding is correct. When you access an index of an array you get back whatever is stored there, and can perform any action you normally could perform on said value type. So if the value is an object you can access its properties in the way you normally can, with either dot notation or bracket notation.