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 Super Conditional Challenge

Michael Gardiner
Michael Gardiner
4,282 Points

Location of problem?

Not seeing the issue here

script.js
var money = 0;
var today = 'Thursday'

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.");
}
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="script.js"></script>
</body>
</html>

3 Answers

Also, you should be using &&, which is basically AND, instead of ||, which means OR. Also, you used !== towards the end, but you should have used ===, since you are checking to see if today is Friday, according to the alert that will be thrown if the condition is met. Your code should look like this:

var money = 0; var today = 'Thursday'

if ( money >= 100 && today === 'Friday' ) { alert("Time to go to the theater");
// if you have 100 money or more, and today is Friday, then throw the alert. } else if ( money >= 50 && today === 'Friday' ) { alert("Time for a movie and dinner");
// if you have 50 money or more (but not 100 or more), and today is Friday, throw this alert } else if ( money > 10 && today === 'Friday' ) { alert("Time for a movie");
//if you have more than 10 money (but not 50 or more), and today is Friday, throw this alert } else if ( today === 'Friday' ) { alert("It's Friday, but I don't have enough money to go out");
// if today is Friday, but you don't have enough money to meet any of the above conditions, then throw this alert } else { alert("This isn't Friday. I need to stay home."); // if today is not Friday, then throw this last alert

hope this helps!

this is the full on best answer imo.

I am not sure what the issue actually is, but there seems to be a logic problem

else if ( today !== 'Friday' ) { alert("It's Friday, but I don't have enough money to go out");
}

This conditional is evaluating to true because it is var today = 'Thursday' AND ( today !== 'Friday' ) , but then in the alert... it seems to indicate that this part of the conditional is supposed to be if it IS friday.

Try putting a semicolon after declaring your today variable, which would look like this:

var money = 0; var today = 'Thursday';