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 trialDavid Aguirre
8,170 PointsA bit of logic
I wrote down the part that says if Column Location is less than the total columns - 1
But the thing is that the Columnlocation is 0 right or if it's not 0
but less than columns -1
I can understand that the last columns should be the final array [-1]
But I understand how the columns argument can access that information if it's not defined with the total amount of columns....
1 Answer
Steven Parker
231,248 PointsI believe you're referring to the point about 3 minutes into the video where we hear that "Our columnLocation counter starts at 0 instead of 1, which is why we're checking that the column location is less than the total number of columns minus 1."
This is not a suggestion that the index will ever be negative (it will not), but that the index of each item is less than the number of the item you would get by starting a count at 1. And, the very last item has an index number that is one less than the total count. So if you had 4 columns, the index number of the last one would be 3.