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 The Conditional Challenge Solution

"Challenges in finding the correct answer for the super conditional challenge"

I have tried so many ways to getting the correct answer to the challenge.When I add my code,my answer pops up secondly.

Can you provide your code so people can see your mistake? Thanks :)

5 Answers

This one you just have to correct the coding that they have given. Remember that the double bars mean "or", so your statement (and all other statements in this challenge) are stating that only one of the two conditions must be met in order for the challenge to pass. Yet, the challenge is to have the statements pass if both conditions are satisfied.

You have an 'else' with an 'else if' afterwards, that can't be executed. 'else' should always come after an 'else if'. :)

I have re-written the code this way,,,,it has to pop up "It's Friday but I don't have enough money to go out" 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 === 9 ) { 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."); }

Thank you,here's the 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' ) {
  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.");
}else if(money===9 || today==='Friday'){
alert("It's Friday.but I don't have enough money to go out")
}

edited for proper formatting.

You need to change the double bars (||) to double ampersands (&&). Your wanting to say that both conditions must be met in order for the alert to occur.