Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Cena Sutton
3,823 PointsConditional statement My code does not work after the first if statement
var score = 0; var question1 = prompt("What is the best programming language?"); if (question1.toUpperCase() === "PYTHON") { score += 1;
}
var question2 = prompt("What is the second best programming language?"); if (question2.toUpperCase() === "JAVASCRIPT") { score += 1;
}
var question3 = prompt("What city is Will Smith from?"); if (question3.toUpperCase() === "PHILADELPHIA") { score += 1;
}
var question4 = prompt("Where is Nicki Minaj from?"); if (question4.toUpperCase() === "NEW YORK") { score += 1;
}
var question5 = prompt("What color is the sun?"); if (question5.toUpperCase() === "YELLOW") { score += 1;
}
document.write("Your score is " + score);
if(score === 5) { alert("You win gold!"); }else if(score === 3 || score ==== 4){ alert("You win silver!"); }else if(score === 1 || score === 2){ alert("You win Bronze!"); }else{ alert("You Lose!"); }
1 Answer

Adam Beer
11,313 PointsJust a typo. Correct your code. You use 4 "=" instead of 3 "=".
} else if(score === 3 || score ==== 4){
to
} else if(score === 3 || score === 4){

Cena Sutton
3,823 PointsThank you!
Adam Beer
11,313 PointsAdam Beer
11,313 PointsCode
Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.