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

Vlad Tanasie
Vlad Tanasie
7,201 Points

The task is not explained right, no matter how I get the right answer I do not get the green check mark.

No matter how i change the code for the task to get the right answer i do not pass the question, it just gives me the same error that there seems to be one or more "||". If there is only one way to get the right answer it should be specified.

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

if ( money >= 100 || today === 'Saturday' ) {
  alert("Time to go to the theater");    
} else if ( money >= 50 || today === 'Sunday' ) {
  alert("Time for a movie and dinner");    
} else if ( money > 10 || today === 'Monday' ) {
  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>

2 Answers

Emmanuel C
Emmanuel C
10,636 Points

The task says "Fix this script so that it correctly tests the money and today variables"

It wants you to use AND not OR.

Vlad Tanasie
Vlad Tanasie
7,201 Points

I know, but shlouldn't it ask to change the OR to correctly run, rather than asking to fix the script?

Kevin Gates
Kevin Gates
15,053 Points

Vlad Tanasie : the AND/OR operators are a part of the Script. You're suppose to read the True/False statements and evaluate what needs to be changed. If this were code I was writing, my days listed were probably right, but it's not working how I would expect. Therefore, it's more likely I'm writing Friday correctly and mistyped a special character -- like the OR operator or the AND operator.

Kevin Gates
Kevin Gates
15,053 Points

Reset your challenge, then update the operator symbols in your IF clauses. Should not be OR ||.