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.

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements Introducing Conditional Statements

this is exactly what he's asked to write.

the instructor said that you must have the document.write command to give the message that you are correct?

app.js
var answer= prompt("what is the best programming language?");
   if (answer==="Javascript" {
       "You are correct"); }
index.html
<!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

thank you otec.

Adam Beer
Adam Beer
11,314 Points

No! You forget the closing bracket of if() statement. And you forget the alert() dialog. Until your problem isn't resolve, please use one topic/question.

it is adam. the first line works fine. then it asks to do a conditional statement saying it's JavaScript. You are correct. I'm following his exact example. but it's not working

Adam Beer
Adam Beer
11,314 Points

Okey, but where are your alert() dialog?

Otec Perez Glass
Otec Perez Glass
7,678 Points

There you go include the the string inside the the conditional like this

alert( "You are correct" );  // hopefully that will help you.