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

Leo Marco Corpuz
18,975 Pointsconsole print on separate lines
Practicing Object Literals in Javascript
On the first challenge my code works but it prints on the same line. How do you print each loop on separate lines? Here's my code:
1 Answer

Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsHey @marcocorpuz , just add a newline character \n
at the end .
Here is the code:
let phrase=""
for (var x in book){
phrase += x + ": " + book[x] + '\n';
}
console.log(phrase);
And you will get the way through .
Hope it helps :)
Leo Marco Corpuz
18,975 PointsLeo Marco Corpuz
18,975 PointsThanks!