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

Justin Bigos
Justin Bigos
3,828 Points

Story Maker Project

My story maker project only worked when I deleted the closing h2 tag.

var name = prompt('Please type your name'); var sentence = '<h2>My name is ' + name; var hobby = prompt('Please name a hobby'); var drink = prompt('A drink you like'); alert('Your done. Want to see?'); sentence += ' and I like to ' + hobby; sentence += ' while drinking ' + drink + '.'; document.write(sentence);

Is there a reason? I ended up copying the instructors example exactly which worked with the </h2> tag to see what the issue could be, it worked fine. So I re-wrote my profect again but still no go if I added the closing h2 tag. It worked perfect w/o it. Any ideas out there?

Justin

2 Answers

Kirby Abogaa
Kirby Abogaa
3,058 Points

Where did the h2 element come from? May i see your html file?

Justin Bigos
Justin Bigos
3,828 Points

There is no h2 in HTML just an h1. The h2 was to added to the JS to insert a sentence. The only reason I used the h2 tag was because in the solution the instructor had done so.