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 trialGareth Partridge
13,421 Points&& operator
I am not to sure where the && operator applies in this Challenge, any suggestions?
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 ( 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.");
}
<!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
231,275 PointsIt looks like you already applied it correctly in two places. I guess you noticed that the tests should be checking the money and if today is Friday.
But keep going, there's a couple more operators that aren't doing the right thing yet further on in the code.
Gareth Partridge
13,421 PointsHi Steven
Thanks for the reply, could you perhaps suggest where in the code? as I have gone through each line...........
Steven Parker
231,275 PointsThere's one more line similar to the two you already fixed, that combines a money test and a test for today.
Plus, there's yet another line where the operator is doing something that isn't compatible with what the message will say.
Gareth Partridge
13,421 PointsGareth Partridge
13,421 PointsThanks so much got it, after almost an hour.....
Steven Parker
231,275 PointsSteven Parker
231,275 PointsGood deal! This challenge is unlike most others, but even if you need to do this kind of thing again I'd bet it would go much faster.
Happy coding!