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 trial

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

The exercise marks that is wrong in the task 1 but I dont chage nothing in the line of the task 1

In the task 3 mark me that the answer is wrong because the line of the task 1 is incorrect but I don't change nothing

app.js
var answer = prompt("What is the best programming lenguage?");
if( answer === 'JavaScript' );{
  alert("You are correct");
}
else{
  alert("JavaScript is the best lenguage!");
}
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>

I ran your code through the challenge. It passed the second part with the extra semicolon. But it would not pass the third part till the semicolon was gone. Semicolon is the winner!

2 Answers

It could be the semi colon, but there's something else more insidious. Look at the spelling of "language" in the else clause. Even if the code is correct, Spelling errors will cause the challenge NOT to pass. I found out the hard way many times.

Thanks

Nicholas Vogel
Nicholas Vogel
12,318 Points

You have an extra semi-colon in this line:

if( answer === 'JavaScript' );{

There shouldn't be a semi-colon before the opening curly brace.

Thanks