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

JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects The Build an Object Challenge, Part 2 Solution

maya sophie
maya sophie
5,754 Points

My solution...differences...good or bad?

I defined name,track,achievements and points first because looks more logical. Second, I used <br> instead <p>. Any difference?

https://w.trhou.se/tw6tmvb2ot

P.S. I still did'n't get the point of having : ............................function print(message) { document.write(message);.....................when we use print(message) at the end......I just don't have it clear at all

2 Answers

Steven Parker
Steven Parker
231,248 Points

While you can always override it with CSS, by default the <br> element only goes to a new line, but the <p> element provides padding and provides a "block" mode container for its content. The end results may look similar, depending on the context, but in other cases (particularly when additional CSS styling is used) the differences will be apparent.

And the code that begins with the word "function" is what defines what the "print" that is used later will do, and is necessary. to make it work.