Map of Places explainer

Thank for flagging; we’ll fix the instructions.

The instructions should use place.color, not place.location.


Hi there,
I was wondering how you guys created the grid on the background, so I checked the hidden code and have a question about it. In the classic for loop, it’s written i=i+20, so I guess it updates the value of the i everytime. I would have expected a simple var i=0; i<400; i + 20 : is this latter wrong or is there a reason why it’s better to update the value of i? Thank you :slight_smile:

Hey there, i + 20 just adds together the value of i and 20, but doesn’t do anything with the value. This means that i would have the same value on each loop, causing each line to be drawn on top of the one before. Instead of a grid, you’d just get one line.

i = i + 20, or i += 20 (both do the same thing) will add together the value of i and 20, and then assign that value back to i. That means that i will increment by 20 on each loop, creating a grid pattern.

Hope this helps!

Makes sense! I got it now, thanks!