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!
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
Kevin Alvarez4,851 Points
Why is necessary to use paragraph tags in his print function? Why not just use the document.write( ) method with string quotation marks instead of using the tags, when you need to print something on to the page?
Cindy LeaCourses Plus Student 6,497 Points
The paragraph starts a new line. Just printing spaces doesn't.
john larson16,594 Points
Hi, I believe the answer is...it's NOT necessary. As far as the p tags vs no tags: The p tags or li tags will come with certain styles that may help the look of what's being printed. Without any tags, a line of text may just run on. A p tag will break the line up and add some padding or margin (I forget which). An li tag will break the line up, maybe add a bullet but I think no padding or margin.
Jonathan GrieveTreehouse Moderator 91,243 Points
The paragraph tags help add some HTML into your JS scripts. You can then target the output HTML with CSS selectors to display the text how you want.
The paragraph tag in your string will put the text on a new line but you can also do this with the
\n escape character.