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) Storing and Tracking Information with Variables The Variable Challenge Solution

B G
B G
1,866 Points

How on earth was I supposed to know to use HTML to type the sentence?

Did I miss something in this course? I do not remember the teacher stating to use HTML to type the sentence. Also why does he actually type the opening and closing <h2> in the sentence? Couldn't you just use the words? I wouldn't have figured this out without watching the video. Unable to complete the task on my own.

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The last instruction of the story-making game challenge is this (in the video):

  1. Print the story to the browser window.

In the workspace you'll find a slightly different set of instructions with an additional clue:

  1. Print the resulting story to the browser using the document.write() command.

We print to the browser by using document.write. And, of course, the browser renders HTML (among other things). You can use HTML tags but you don't have to. Any document.write will add the strings (with or without HTML tags) to the body. Text that doesn't contain HTML tags will inherit any stylings that the body might have. He didn't have to use the <h2> tags, but he wanted to make it stand out a bit. To be clear, these extra challenges are just that. They are challenges to help you practice.

Hope this helps! :sparkles:

Swedina Yolanda
Swedina Yolanda
931 Points

Just a suggestion, perhaps the teacher could explain why he used the <h2> tag, in the video. I'm just afraid some students make a wrong assumption (the majority of students won't read this thread anyway).

Thanks for the great and comprehensive answer.

tal Shnitzer
tal Shnitzer
Courses Plus Student 5,242 Points

why does he use the HTML <h2> of the HTML? I did it w/o and it worked just fine.

what was the contribution of the h1?

Jennifer Schultz
Jennifer Schultz
1,944 Points

The <h2> tags are just to make the font larger so it's more readable. I initially did this without any html and it came out fine but the text was tiny, so I added the h2 tags to make it larger. :)

Hanan Fadah
Hanan Fadah
1,131 Points

It is best to learn HTML and CSS before jumping into Javascript.

Byron Farrow
Byron Farrow
13,267 Points

I'd say yes. At least the basics. JavaScript's main purpose is to provide additional functionality to web pages, so it makes sense.