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.

Liam Hayes
Full Stack JavaScript Techdegree Student 13,116 PointsQuestion about Syntax in JavaScript
Check this out, this is from one of the quizzes:
What is a "syntax error"?
A A logical mistake in your programming.
B Forgetting to add a closing <script> tag to a web page.
C A "grammatical" mistake like mistyping a JavaScript command or forgetting a closing parentheses or quote mark.
D Using the wrong path when linking a JavaScript file to a web page.
The correct answer is C.
My question is, how come the correct answer is not B?
It because B is in HTML? Would that be an HTML syntax error? Or would this error be a different kind of error?
Thank you!
1 Answer

Poly Goveia
5,224 Pointsscript tags are found in HTML, and not in JavaScript. So in this case forgetting to close a script tag would be a syntax error in HTML and not in JavaScript.

Gari Merrifield
9,571 PointsI don't think that the missing tag would generate an error itself, the error would be reported when the browser tried to interpret the HTML code following the missing script tag as JavaScript. And the page would likely stop rendering at that point. I think Poly has this nailed down, you have to consider the context, and the script tags delineate the script from the HTML, so technically, the missing tag is more likely considered a mark-up error.
Steven Parker
220,925 PointsSteven Parker
220,925 PointsCan you provide link to the specific quiz? I expect there's something in the wording of how "syntax error" was defined that will distinguish the correct answer here.