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 trialMarco Nacianceno
1,949 PointsThe 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
var answer = prompt("What is the best programming lenguage?");
if( answer === 'JavaScript' );{
alert("You are correct");
}
else{
alert("JavaScript is the best lenguage!");
}
<!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
john larson
16,594 PointsIt 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.
Marco Nacianceno
1,949 PointsThanks
Nicholas Vogel
12,318 PointsYou have an extra semi-colon in this line:
if( answer === 'JavaScript' );{
There shouldn't be a semi-colon before the opening curly brace.
Marco Nacianceno
1,949 PointsThanks
john larson
16,594 Pointsjohn larson
16,594 PointsI 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!