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,071 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
PRO
Gustavo Winter
Pro 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];