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 trialOrland Bagayas
947 PointsWondering about the broken <h2> tag
The code on the video assigned one variable with an opening <h2> tag and ended the statement with a semicolon. Now more variables are declared and assigned a string value, ending each statements with a semicolon. One thing I noticed is the last variable which has the closing </h2> tag. Why does the <h2> tags still work even though it is broken and each statements are ended with a semicolon?
2 Answers
Steven Parker
231,248 PointsThe semicolons are not part of the constructed string.
The JavaScript statements end with a semicolon, but that is not part of the string that the statements are building. The string is not written into the document until it is complete.
Nicholas Hartzheim
6,005 PointsCan anyone tell me where h2 tags were discussed previously? I don't remember it being discussed in any of the lessons. It seems pretty foreign to me...
Orland Bagayas
947 PointsThe <h2> tags are HTML tags and are not included in this Full Stack Javascript course, at least on the course description. The <h2> tags are used to format the texts that appear on the webpage and Javascript codes can be written inside <h2> tags for formatting. Ideally, one should already have some background about HTML and CSS when studying Javascript as these languages work hand in hand. No worries though, HTML and CSS are pretty much simpler than Javascript :)