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!

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

hello, I have no idea why it says task one is no longer passing because in my opinion it definitely should!

can someone help me with finding my mistake?

var answer = prompt('What is the best programming language?');
if (answer.toUpperCase === 'JAVASCRIPT') {
    return alert('You are correct');
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>

1 Answer

28,554 Points

There are two issues with your code:

  1. You don't actually call the toUpperCase function, you only reference it. In order to call functions you have to place parenthesis after the name of the function like this "answer.toUpperCase()"

  2. The return keyword is used to return data from a function, an if statement is not a function so using that is invalid. This is the reason why task 1 is no longer passing, this invalid syntax crashes the code checker as it tries to validate your code.

If you fix those two issues like this:

var answer = prompt('What is the best programming language?');
if (answer.toUpperCase() === 'JAVASCRIPT') {
    alert('You are correct');

Then you'll be able to pass onto task 3.