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 The Build an Object Challenge, Part 2

Vic Mercier
Vic Mercier
3,276 Points

student = students[i];

If I understand well that means the student variable can change?

2 Answers

Stuart Wright
Stuart Wright
41,120 Points

That line of code would appear inside your for loop, where i is greater than or equal to 0, and less than the length of your array.

student = students[i] will then result in the item at index i in the array being assigned to variable student.

Gustavo Winter
PLUS
Gustavo Winter
Courses Plus Student 27,382 Points

Every time the looping run the variable "i" will get one valor. Each valor represent a objects inside your array, Ex: [0, 1, 2, 3, 4]

In each loop the variable "student" asborve the array content. Obs: every looping the variable "i" will added by 1. At the end of every loop the result of "student" appears at the screen.

student= students[i];