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 trial
zhengyutang
9,548 PointsThere might be a missing 'var' in the quiz.
At 'JavaScript Loops, Arrays, Objects" Object section's 12th part gives me below questions:
Given the following JavaScript code:
var car = {
make: "Ford",
model: "Fiesta",
year: 2015
}
for ( property in car ) {
console.log( property );
}
zhengyutang
9,548 PointsThe question is, is there a missing 'var' in the for loop?
1 Answer
Daniel Santos
34,969 PointsThank you for clarify it.
And the answer is no, because you are using property as a temporary variable that holds the values of the properties. In each iteration you are changing the value of property and printing it out.
I hope this helped. Let me know if not, I can try to come out with something different.
-Dan
Daniel Santos
34,969 PointsDaniel Santos
34,969 PointsWhat is your question?