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

Iifo Edward
Iifo Edward
16,020 Points

Hi! How can i solve this challenge. Can someone give me the corrects codes to use. Thanks

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' ) {
  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.");
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
    <script src="script.js"></script>

1 Answer

Steven Parker
Steven Parker
210,442 Points

You're close, but you changed the output messages (by removing the punctuation) so they are not being recognized. And the original code did not have two separate results for "movie" or "theater".

But instead of a total re-write, a better solution (and what the challenge was asking for) would be to just change the operators in the tests so they match what the original messages were putting out.