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 am not sure what's wrong with my code. Please, help me

var question1 = prompt("Who is the best man?"); var question2 = prompt("Which is my favorite team?"); var question3 = prompt("Where am I from?"); var question4 = prompt("What is my hair color?"); var question5 = prompt("Where is my favorite place?"); var correctAnswers = 0;

if (question1.toUpperCase() === 'DUSTIN BROWN') { correctAnswers += 1; } if (question2.toUpperCase() === 'LA KINGS' || question2.toUpperCace() === 'LOS ANGELES KINGS') { correctAnswers += 1; } if (question3.toUpperCase() === 'JAPAN') { correctAnswers += 1; } if (question4.toUpperCase() === 'BLACK') { correctAnswers += 1; } if (question5.toUpperCase() === 'LOS ANGELES') { correctAnswers += 1; }

if (correctAnswers === 5) { document.write('You got a gold crown, baby!'); } else if (correctAnswers < 5 && correctAnswers > 2) { document.write('You got a silver crown, dude!'); } else if (correctAnswers < 3 && correctAnswers > 0) { document.write('You got a bronze crown') ; } else { document.write('Bye Bye Bye'); }

quiz.js:11 Uncaught TypeError: question2.toUpperCace is not a function at quiz.js:11

2 Answers

You typed:

 question2.toUpperCace()

instead of :

question2.toUpperCase()

Thank you very much!!!! Osaro!

Glad I can be of help Takuya.