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 trialachiker
11,748 PointsAt 03:14 shouldn't it read "In other words, the last item of the first student's ..." for position 3 to be accessed?
I was trying to figure out how position three was picked out amongst other index of positions within the inner array of the first student's grades and it kind of confused me a bit.
1 Answer
Ali Abbas
2,097 PointsHey achiker,
I'm not quite sure about the confusion. I personally thought he was clear and precise in making his point. I'll try and hopefully clarify it nonetheless, I hope you find what I say helpful.
First, when it comes to arrays. The index position always begins from zero, as I'm sure you're aware. So, [80, 90, 100, 95] are the grades that belong to student one. The first number 80 is at position [0] and the last number 95 is at position [3]. So, when it comes to arrays, it always starts from 0 and not 1. Again, I'm sure you are aware of this. Now, the second student's grades are [75, 95, 85, 100] and is placed below the first student. However, how would you differentiate between the two? Just like the index positions of the grades are counted from 0 going across, the index position for the students are counted from zero going downwards. So, counting downwards, the first student is at index position 0 and the second student is at index position 1, and student 3 who is below student 2 is at index position 2.
[0][3] represents the first student and his last grade. It should be clear that the first brackets considers the index position of the students and the second brackets consider the index position of their grades. Another example being, [1][2] which represents student 2 at index position 1 and their grade at index position 2, which is 85.
I hope this was clear. Take care.