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 trialIrfan Hussain
Courses Plus Student 6,593 PointsYou did not use var
In video Using for in
to Loop through an Object's Properties you says that var and in is important in for loop.
But when you build for loop you use bellow syntax: for (prop in person)
Bit confused. I used var in my practice.
5 Answers
jeroenmaljers
1,708 Pointsnoticed the same: the exercise says :Bummer! It's a good idea to use the var
keyword in a for in
loop like this: for (var key in shanghai)
.: But Dave does not do that in the video.
Simon Coates
28,694 Pointstake a look at this . I think there's scope implications.
louiecamacho
10,980 PointsYES, this makes it very confusing!
Steve Fan
8,218 PointsYes, I have confused about that. Why he did not use "var" in "for in" but in the exercise, it requires to use "var" like a must.
xayide carassa
3,195 Pointsvery confused on this as well. Can any one from TreeHouse staff provide us with some clarity?
Simon Coates
28,694 Pointsxayide carassa With an older forum post, you're unlikely to get attention from anyone on treehouse's staff unless they're already subscribed to that post, or you use the tagging syntax. Your start typing @ and then the person's name and a menu should come up to select the user (the menu is a little buggy sometimes). I think if they're still active, they should get notified.
so you can directly ask a member of staff or an advanced user (assuming they're active). Some of treehouse staff are pretty good at responding with detailed, thoughtful answers to user questions.