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 trialKatherine Tuter
6,031 PointsCan't figure out why task 1 is no longer passing...
I completed task 1 correctly but am stuck on task 2. It keeps saying task 1 is no longer passing. It looks like my code is correct but can someone wiser and more experienced take a look? I have no clue how to fix this.
var answer = prompt('What is the best programmming 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>
1 Answer
Steven Parker
231,271 PointsYou have a string that you forgot to enclose in quotes.
A syntax error will invalidate the whole program, making the challenge think something has gone wrong with the task 1 part. But you have a couple of other issues as well:
- the challenge asks you to use an alert, but you have document.write
- the alert string is not HTML, and should not have tags around it
Katherine Tuter
6,031 PointsKatherine Tuter
6,031 PointsThanks for the help guys! I totally misread the 2nd task instructions, oops.