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

Oops! It looks like Task 1 is no longer passing.

I've been over my code over and over again. As I get to task 3, task one doesn't work anymore and I can't see why?

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

2 Answers

Kieran Barker
Kieran Barker
15,028 Points

Hi Ioana,

It might be because of the semicolon you have on this line:

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

It's not needed -- just type the following:

if (answer === "JavaScript") {

The semicolon is used to end a statement, so the JavaScript interpreter is probably getting confused.

I hope this helps! :-)

You are Amazing! Thank you! So silly of me :))!

Kieran Barker
Kieran Barker
15,028 Points

No worries; it's easy to miss little things like that! Be sure to check your browser's JavaScript console; it will spot lots of errors like this!