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

All works well except the conditionals, why?

quesnum = 3
punt = 0

question1 = prompt('what the capital of Kazajistan?' + " " + quesnum);
quesnum -= 1;

if (question1.toUpperCase === "KAZA") {
  punt += 1  ;
};

question2 = prompt('who was the the 24th president of the usa' + " " +  quesnum);
quesnum -= 1;

if (question2.toUpperCase === "LINCOLN") {
  punt += 1  ;
};

question3 = prompt('how long in meters is the eiffel tower?'+ " " +  quesnum);
quesnum -= 1;

if (question3.toUpperCase === "14") {
  punt += 1;
};




if (punt === 3) {
  alert ('you are badass')  
}

else if (punt === 2) {
  alert ('you are kick ass')  
}

else if (punt === 1) {
  alert ('you are all right')  
}
else {
 alert ('you lost')   
}

2 Answers

You do not have semicolons (;) after the statements in the blocks for your conditionals.

In JavaScript I don't believe you need semicolons.

Hi Wilfredo,

In your calls to the .toUpperCase() method you forgot to put parentheses at the end. Example: question1.toUpperCase

Without the parentheses it won't call the method. Instead it's a reference to the method. So you're always comparing if a function reference is equal to some string.