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 triallifelonglrnr
2,397 PointsConditional Statements: Module 2 Challenge 1 of 3. I'm getting "syntax error" and can't tell why? Please help.
Looks just like timestamp 1:58 of Module 1 (except the prompt contents, of course) so I'm lost. Please help.
var answer = prompt(βWhat is the best programming language?β);
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>
2 Answers
Emmanuel C
10,636 PointsWhat are you using for quotes? They are not being recognized as single or double quotation marks, or even backticks. I can't recreate that character. Try using regular single quotes for that string. if not then use double quotes. In javascript they are interchangable, though you must end a string with the same mark you start one with.
Richard Verbraak
7,739 PointsYou're getting a syntax error because whatever those characters are, they're not quotes. In Javascript, anything within a set of quotes like so "I am a quote" is being interpreted as a string.
Basically, the interpreter doesn't recognize those characters and throws back a syntax error at you. Just pick either single quotes ' 'or double quote marks '' '' for strings .
However, be consistent with the one you choose to use from now one, otherwise it will look confusing for yourself or anyone else for that matter.