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.

maria ramirez
12,068 PointsMy program won't start
What is wrong with my code. My program is not running
var score = 0;
var firstAnswer = prompt ("What is the complementary color for red?");
var secondAnswer = prompt ("Is black a color?");
var thirdAnswer = prompt("What color do perfect complementary colors mixed together should produce?");
var fourthAnswer = prompt ("What is the base for acrylic paint?");
var fifthAnswer = prompt("How many colors are in the rainbow?");
if (firstAnswer.toLowerCase === "green") {
score +=1;
}
if (secondAnswer.toLowerCase === "no" || secondAnswer.toLowerCase === "false"){
score +=1;
}
if (thirdAnswer.toLowerCase === "gray") {
score +=1;
}
if (fourthAnswer.toLowerCase === "water") {
score +=1;
}
if (fifthAnswer.toLowerCase === "seven" || fifthAnswer === "7") {
score +=1;
}
document.write("<p> You scored " + score + " questions right!</p>");
if (score === 5) {
alert("Congratulations!, you get a gold crown!");
}
elseif (score < 5 && score >= 3 ) {
alert ("You get a silver crown!");
}
elseif (score < 3 && score >= 1) {
alert ("You get a bronze crown");
}
else {
alert ("Please try again");
}
1 Answer

Ken Howard
Treehouse Guest TeacherChange your elseif
's to else if
and you'll be good to go!

maria ramirez
12,068 PointsThanks! this helped a lot. I also noticed I was missing the () after toLowerCase
Carlos Federico Puebla Larregle
21,073 PointsCarlos Federico Puebla Larregle
21,073 PointsI think you have a few typos in those final "alert" functions, you have a white space between the "alert" keyword and the parenthesis. alert("You get a silver crown!"); alert("You get a bronze crown!"); alert("Please try again");
I hope that helps.