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

https://www.dropbox.com/s/pxsvm1pcu9o4meg/Screenshot%202016-06-28%2001.53.50.jpg?dl=0 i got the answer but quiz won't en

https://www.dropbox.com/s/pxsvm1pcu9o4meg/Screenshot%202016-06-28%2001.53.50.jpg?dl=0 i got the answer but quiz won't end,

So annoying i can't press next.. UX error 101.

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 ( money < 10 || 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

Steven Parker
Steven Parker
231,269 Points

You may have created a working program, but it has a different functionality than what the challenge is looking for.

As provided initially by the challenge, the program is using the wrong logic to combine the tests for money and today. The tests themselves are correct, but they both need to be true. So they need to be combined with the and operator (&&) instead of the or operator (||).

Then the final test checks only the day, but it needs to check that today is Friday instead of checking that it is not Friday.

Hopefully you can get it now.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Steven Parker is correct. I thought I'd throw in a concrete example. What if that weren't a 9 and a Friday? What if it were a -2 and a Tuesday? According to your code, it would print out: "Time to go to the theater!". Your code passes for that particular condition, but it wouldn't pass for all conditions. Because the second set of values contains a value not equal to "Friday" the first if statement would evaluate to true and print out the aforementioned string in an alert.

Faisal Rahimi
Faisal Rahimi
4,019 Points

just change || to && in all of them and choose alert("It's Friday, but I don't have enough money to go out");