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

Can someone can help me to resolve this problem I am trying to solve. Can you please find the mistake in the code.

else if (money >= 1 && today === 'Friday')

but alert message is printing wrong.

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 (  money >= 1 && 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>

3 Answers

Chidiebere Ekennia
Chidiebere Ekennia
5,947 Points

I've gone over this before Nasim. It seems you edited the original code quite a bit. But that's Ok. The bug that's left for you to correct would be in the 3rd "else if" code block. The logic/condition is wrong there. The proper condition should read (money < 10 && today === "Friday"). That way, the statement "It's Friday, but I don't have enough money to go out" would be valid, since var money = 9

Thank you for reply, I tried your code but problem is not solved, When I run the code message is same as before.

Chidiebere Ekennia solved my problem. Thanks a lot.