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 trialNelson Lourenco
1,766 PointsNot seeing output on FF 39 for Mac
var person = {
name : 'Sarah',
country : 'US',
age : 35,
treehouseStudent : true,
skills : ['JavaScript', 'HTML', 'CSS']
};
for (prop in person) {
console.log(prop, ': ');
}
When I goto the console tab of the native inspector, I don't see anything?
1 Answer
Abe Layee
8,378 PointsI believe the error is from your console.log(). You're also using concatenating the incorrect way. After the prop, you want have the + then follow by the person. Something like this.
var person = {
name : 'Sarah',
country : 'US',
age : 35,
treehouseStudent : true,
skills : ['JavaScript', 'HTML', 'CSS']
};
for (prop in person) {
console.log(prop + ': ' + person[prop]); // it should be like this.
}
Iain Simmons
Treehouse Moderator 32,305 PointsActually using commas to pass multiple arguments to console.log
is perfectly valid, though they were missing the last one person[prop]
.
They said that they weren't seeing anything in the console though.
ericb2
11,429 Pointsericb2
11,429 PointsI can eliminate one possiblity to simplify your troubleshooting. I had no trouble running your copy-and-pasted code in FF 39 on my Mac, so it is unlikely a browser bug.
Two simple problems I chronically run in to have cost me hours of needless troubleshooting: 1) I forget to save my script and/or refresh the page. and 2) I have to click twice (or maybe double click?) on the 'logging' tab of the console for the output to show up sometimes. This still baffles me.
good luck.