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

Super conditional challenge

I have read the instructions but does it want me to change values and the script or does it want me to keep the script in place and change values to match script or all of the above? or Just move the script around bc today=== 'Friday' is not a true state value for any of them and am I suppose change the whole thing?

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

if ( money >= 100 || today === 'Friday' ) {
  alert("This isn't Friday. I need to stay home.");    
} 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("Time to go to the theater");
}
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>

2 Answers

Steven Parker
Steven Parker
231,007 Points

I believe the intention of the challenge is that you will change only the comparison operators and the logic operators to cause the alert statements to be issued for the appropriate conditions. You don't need to (and probably should not) change the basic structure of the script or the order of the tests and messages.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Kaleb,

You will need to reset the challenge and start over. The challenge does not want you to change the value of the variables or any of the order of checks.
For this challenge, you need to think of the logic and what is being asked and how.

Right now, it is Friday and you have $9.00.

The first if is saying ... If I have more than $9.00 OR today is Friday ... I get to go to the theater. Now the theater costs more than $9.00, but you don't have it, so why did it pass? Because the code is checking for one or the other to be true (OR), when it should be checking to make sure both are true (AND).

Hope this helps.
Keep Coding! :)

:dizzy: