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

student = students[i];

Does this line of code within the for loop, run through and insert each key value pair from the array of students into the variable student? -- Which can then be accessed each time using the dot notation.

1 Answer

Steven Parker
Steven Parker
231,172 Points

It doesn't exactly "insert" anything, but you do have the right idea. This line makes "student" refer to one specific object in the "students" array, based on the current loop index. You can then use a membership operation (dot or bracket notation) to access the attributes within it.

Awesome. Thanks for the response Steven, much appreciated! :)