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

I am having trouble understanding what this question wants me to-do.

It looks like task 1 is no longer working.

app.js
var answer 
prompt('What is the best programming language?')
if(answer == JavaScript){
    alert(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>
Joel Bardsley
Joel Bardsley
31,249 Points

Remember to use strings for the answer and the alert. Syntax errors in your code are causing the 'task 1 is no longer working' message to appear.

4 Answers

@Joel Bardsley It still says no longer passing

When I made the change

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

You are not storing the prompt in the answer variable. Also remember what Joel Bardsley has said about checking if the answer is equal to a string.

I did the following: var answer prompt('What is the best programming language?') if(answer === JavaScript){ alert('You are correct'); }

var answer prompt('What is the best programming language?') if(answer === 'JavaScript'){ document.write('You are correct'); }

Solved it! Thanks! Mayur Pande

Mayur Pande
Mayur Pande
Courses Plus Student 11,711 Points

no problem, but from looking at your code it still seems wrong! Have you used the equals sign like so?

var answer = prompt('What is the best programming language?') 
if(answer === 'JavaScript')
{
  document.write('You are correct'); 
}

ohja I forgot about the variable equals sorry ill fix it right away. Really appreciate it Mayur Pande .