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 Basics (Retired) Making Decisions with Conditional Statements Introducing Conditional Statements

Aleksandra Laska
Aleksandra Laska
5,343 Points

Why there is <p> ..... </p> in code ? What does it do ?

Java Script

3 Answers

Robin Goyal
Robin Goyal
4,582 Points

So these <>, </> are HTML tags. If he puts an <h1></h1>...<h6></h6>, it means he's writing a heading tag into the document. Javascript allows you to modify the state of the HTML document using something called the Document Object Model (DOM). This is slightly more advanced stuff and it's not necessary for you to know it to complete this course, at least that's what I think.

If you are curious, check out one of the HTML courses just to get a quick idea of what is going on in these videos. But the main focus is on conditional statements and Javascript concepts rather than the tags.

Robin Goyal
Robin Goyal
4,582 Points

When Dave writes

document.write("<p>That's right</p>");

it means that he is adding a paragraph to the document with the text, "That's right".

Aleksandra Laska
Aleksandra Laska
5,343 Points

Is it vital to write it ?

. .

If he writes <h>... </h>, what does it mean ??

Gareth Partridge
Gareth Partridge
13,421 Points

Hello Aleksandra,

it is only Vital if he wants to get a message across they are not part of Java Script in any way, they are HTML tags and you use HTML to print messages to your page, <p> </p> stands for paragraph. <h> </h> stands for heading. a few basics courses in HTML will give you a good understanding.

https://teamtreehouse.com/library/html-basics-2