Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Making Decisions in Your Code with Conditional Statements Use Multiple Conditions

Broken Challenge or I am missing something here

Something's wrong with this script. Can someone give me the right code

script.js
var money = 9;
var today = 'Friday'

if ( money >= 100 && today === 'Friday' ) {
  alert("Time to go to the theater");    
} else if ( money >= 50 && today === 'Friday' ) {
  alert("Time for a movie and dinner");    
} else if ( money > 10 && today === 'Friday' ) {
  alert("Time for a movie");   
} else if ( today === 'Friday' && money < 10 ) {
  alert("It's Friday, but I don't have enough money to go out");   
} else {
  alert("This isn't Friday. I need to stay home.");
}
index.html
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
    <script src="script.js"></script>
  </body>
</html>

3 Answers

Steven Parker
Steven Parker
210,442 Points

For this challenge, you should only change the operators in the conditional expressions.

Don't change any values, and definitely don't change any of the messages or add new ones!

const money = 9; const today = 'Friday'

if ( money > 10 && today === 'Friday' ) { alert("Time to go to the theater.");
} else if ( money >= 50 && today === 'Friday' ) { alert("Time for a movie and dinner.");
} else if ( today !== 'Friday' ) { alert("It's Friday, but I don't have enough money to go out.");
} else { alert("This isn't Friday. I need to stay home."); }

I did this but its not working

Steven Parker
Steven Parker
210,442 Points

The last test needs to check for equal to "Friday" instead of not equal, because it outputs "It's Friday...".

Brian Fitzgerald
Brian Fitzgerald
2,691 Points

How is that the internal Treehouse editor tells you the answer is correct and when you check the answer the same error keeps coming up no matter what you change? Is this not a contradiction? Either the editor must be wrong or there is a fault in the code.

Starting to wonder about the value of this course. If it is designed to frustrate you || take you money === job done

Steven Parker
Steven Parker
210,442 Points

How is it that the "editor tells you the answer is correct"? Only the check button can determine if the answer is correct, the editor has no idea what the objective is.

I have been stuck on this for the past two hours and I need to be done by midnight. Will someone please help me? I even have two programmers I have been chatting with who can't figure it out.