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) Introducing JavaScript Your First JavaScript Program

give me the FREAKING ANSWER!

PLEASE HELP IM NEW!!!!

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>

<body>
</body>

<script>
document.write(<h1>"Welcome to my site"</h1>);

</script>

</html>
Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hi billy skako

I understand that you are new and learning code can be frustrating, but "yelling" demands in the community is not the way to get someone to help you or be to respected.

A descriptive title to your post, as well as a very descriptive and detailed explanation as to the problem you are having (including your code), the task's instructions, and any errors you are receiving is the proper way to post in the Community Forum and the best way to get proper assistance from other students.

Please keep this in mind and be respectful in the Community.

Thank you.

Jason ~Community Moderator

2 Answers

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

You were close..

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>

<body>
</body>

<script>
// Write your code here.
document.write("Welcome to my site");
</script>

</html>

This is correct if he just wants to show the plain "Welcome to my site". Although if he wants the h1 to work, it should be ("<h1>Welcome to my site</h>");

I see. I am sorry, you are correct. I did not know that I can view the challenge until now, so I thiught <h1> was really there LOL. I have also just started javascript and currently on my 3rd week. :)

Ming Jun Lim
Ming Jun Lim
10,060 Points

Hi, the problem lies in this line of your code

document.write(<h1>"Welcome to my site"</h1>);

<h1> and </h1> has to be inside the quotation " "

Basically document.write writes directly to the html code. When u do this, the script will write Welcome to my site into the html code.

document.write("<h1> Welcome to my site </h1>");

When the tag is within the quotation, the script will write <h1> Welcome to my site </h1> into the html code. This allows the h1 tag to work.

Hope this helped u :P