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
Mohammed Khalil Ait Brahim
9,539 PointsUnusual blank space
I tried the following code in my browser and it seems that in the output there is a space in the first line that doesn't appear in the others.
var human = {
first_name: "Mohammed Khalil",
last_name: "Ait Brahim",
age: 18.5,
bestSongs : ["FireBall", "Uptown Funk", "Bethoven Moonlight Sonata"],
security: {
id: 1,
codeName: "The GyroScope"
},
getInfo: function() {
var s = this.first_name + " " + this.last_name + " : " + this.age + "\n" + "Best Songs : ";
for(var idx = 0; idx < this.bestSongs.length; idx++)
s = s + this.bestSongs[idx] + (idx != this.bestSongs.length - 1 ? " - " : "\n");
s += this.getSec() + "\n";
return s;
},
getSec: function() {
return "ID: " + this.security.id + "\nCode Name: " + this.security.codeName;
}
}
console.log(human.getInfo());
Jason Anello
Courses Plus Student 94,610 PointsThis is the output I get:
Mohammed Khalil Ait Brahim : 18.5
Best Songs : FireBall - Uptown Funk - Bethoven Moonlight Sonata
ID: 1
Code Name: The GyroScope
Mohammed Khalil Ait Brahim
9,539 PointsI tested my code on chrome's console.
Here is the result :
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Mohammed,
I did a little searching on this and it looks like this is a problem that has come up with recent releases of chrome. The console is outputting a blank space before the actual output.
Here's a few links you can look over:
http://stackoverflow.com/questions/27569043/extra-space-at-beginning-of-console-log
https://code.google.com/p/chromium/issues/detail?id=444580
According to those links you can either fix the problem now by applying the patch or you can wait a few release cycles and the problem should go away.
Mohammed Khalil Ait Brahim
9,539 PointsThank you Jason Anello for the clarification.

Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Mohammed,
When I run your code in firefox/firebug I see 4 lines of output and they're all aligned on the left.
Could you clarify what you mean and what browser you're testing this in?