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 trialVongai Muchabaiwa
6,530 PointsBroken Challenge or I am missing something here
Something's wrong with this script. Can someone give me the right code
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' && money < 10 ) {
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 charset="utf-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
3 Answers
Steven Parker
231,271 PointsFor this challenge, you should only change the operators in the conditional expressions.
Don't change any values, and definitely don't change any of the messages or add new ones!
Brian Fitzgerald
2,691 PointsHow is that the internal Treehouse editor tells you the answer is correct and when you check the answer the same error keeps coming up no matter what you change? Is this not a contradiction? Either the editor must be wrong or there is a fault in the code.
Starting to wonder about the value of this course. If it is designed to frustrate you || take you money === job done
Steven Parker
231,271 PointsHow is it that the "editor tells you the answer is correct"? Only the check button can determine if the answer is correct, the editor has no idea what the objective is.
Amber Puharic
6,307 PointsI have been stuck on this for the past two hours and I need to be done by midnight. Will someone please help me? I even have two programmers I have been chatting with who can't figure it out.
Vongai Muchabaiwa
6,530 PointsVongai Muchabaiwa
6,530 Pointsconst money = 9; const today = 'Friday'
if ( money > 10 && today === 'Friday' ) { alert("Time to go to the theater.");
} else if ( money >= 50 && today === 'Friday' ) { alert("Time for a movie and dinner.");
} 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."); }
I did this but its not working
Steven Parker
231,271 PointsSteven Parker
231,271 PointsThe last test needs to check for equal to "Friday" instead of not equal, because it outputs "It's Friday...".