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

I keep getting one for my correct answers.

I keep getting 1 for my answerCounter, I wonder what is the problem?

var answerCounter = 0;

// 5 Questions
var questionOne = prompt("What color is the sky?");
if (questionOne.toUpperCase === "BLUE") {
  answerCounter += 1;
}


var questionTwo = prompt("How many fingers and thumbs do you have?");
if (parseInt(questionTwo) === 10) {
  answerCounter += 1;
}


var questionThree = prompt("What's the best programming language?");
if (questionThree.toUpperCase === "JAVASCRIPT") {
  answerCounter += 1;
}


var questionFour = prompt("What's your favorite color?");
if (questionFour.toUpperCase === "RED") {
  answerCounter += 1;
}


var questionFive = prompt("What state do you live in?");
if (questionFive.toUpperCase === "CA" || questionFive.toUpperCase === "CALIFORNIA") {
  answerCounter += 1;
}







document.write("You got " + answerCounter + " right!"); 

1 Answer

toUpperCase is a method so you'll need a set of parentheses after it so it won't try to compare the answers to the function itself.