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 Pointsconditional statement
he said no semi colon after conditional statement yet this is exactly matched to the simple example he gave?
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>
2 Answers
Adam Beer
11,314 PointsFirst, after the answer where is your "="? Like this, var answer = prompt(). Second, in the sonditional statement you shouldn't use brackets. Third, you can use alert() dialog, but you use document.write, why? And finally, your fourth wrong, inside the document.write() you should use " " but you dont use here, but you write <p></p> element, but the question doesn't asks how you use.
Hope this help!
Kim Dallas
11,461 PointsHowdy Dan. I'm completely new to it. I hope you're enjoying yourself. 😁
Daniel Arundel
7,951 PointsDaniel Arundel
7,951 PointsHello Kim,
I hope you're having fun coding. I am fairly new to these forums, so I am not overly experienced in walking fellow students through challenges.
What I would say, is that the task you've been set is asking you to add a conditional statement that opens an alert box. You've done something slightly different. Nearly there though!
~ Dan