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 trialRaedawn Long
6,943 PointsSorry, I am so confused on this last question. I want my print out to read I don't have enough money to go out
Need assistance with this code.
var money = 9;
var today = 'Friday'
if ( money >= 9 || today === 'Friday' ) {
} else if ( money > 10 || today ===);
alert("It's Friday, but I don't have enough money to go out");
} else {
}
<!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
231,275 PointsI 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.
Start over with the original script and take a look at the way the tests are being combined.
The "OR" operator ( || ) is true if either test is true. You want to change the operator so the expressions are true only if both tests are true. You want each if statement to test the money and ( && ) the day. Fix that on each line with two tests.
The final test for just the day only needs to check if it is Friday instead of not Friday.
Give it another shot and see if you can get it now.
Raedawn Long
6,943 PointsThank you Steven! I am trying but continue getting error, I am going to post code.
Steven Parker
231,275 PointsDo you mean post it here, as a comment?
Raedawn Long
6,943 PointsI just posted in group discussion.
Steven Parker
231,275 PointsI found it But you could have added it here in a comment instead of starting another question.
For the benefit of other readers, here is the new question.