Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,408 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