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 trialKim Dallas
11,461 Pointsthis is exactly how he's written in his sample quiz example
in the example this is how the instructor says to do it
var answer=prompt("What is the best programming language?");
if answer===="JavaScript";
document.write (<p>"You are correct" </p>)
<!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>
3 Answers
Steven Parker
231,271 PointsPerhaps it's not quite "exactly" the same .. some differences are:
- the conditional expression following an "if" should be enclosed in parentheses
- the conditional expression should not be followed by a semicolon
- a strict equality test operator has 3 equal signs, not 4
- the instructions ask you to use the alert function, not "document.write"
- the "alert" function doesn't do HTML processing, you won't need any paragraph tags
Kim Dallas
11,461 PointsI wrote it exactly as you advised justinas vebra. it still won't work
Steven Parker
231,271 PointsThat sample isn't quite correct — try the hints I've given you.
Kim Dallas
11,461 PointsI did. I've drawn a complete blank for the last two hours. I don't know why. I was trying to complete the requisite work for code Louisville. I really appreciate all the help everyone gave. Including you
Steven Parker
231,271 PointsKim Dallas — Learning a new skill goes better in measured doses. You may have just been cramming too much into a short time.
Remember you can mark a question solved by choosing a "best answer".
Justinas Vebra
1,053 PointsJustinas Vebra
1,053 PointsCorrect syntax is this:
Make sure you compare your code and mine and see (understand as well) the differences.