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 Solution

Marc Smolinski
Marc Smolinski
1,931 Points

only the questions are working and not the results what's wrong with this code? i've been stuck for hours now.

Here is my code:

var playerScore = 0;

var questionOne = prompt('what is the capital of England?'); if (questionOne.toUpperCase() === 'LONDON') { playerScore += 1; } var questionTwo = prompt('what is the capital of Poland');
if (questionTwo.toUpperCase() === 'WARSAW') { playerScore += 1; } var questionThree = prompt('what is the capital of France');
if (questionThree.toUpperCase() === 'PARIS') { playerScore += 1; } var questionFour = prompt('what is the capital of Germany');
if (questionFour.toUpperCase() === 'BERLIN') { playerScore += 1; } var questionFive = prompt('what is the capital of Belgium');
if (questionfive.toUpperCase() === 'BRUSSELS') { playerScore += 1; }

if ( playerScore === 5 ) { document.write('<p>you earned a gold badge.</p>'); } else if ( playerScore >= 3 ) { document.write('<p>you earned silver badge</p>'); } else if ( playerScore >= 1 ) { document.write('<p>you earned a bronze badge</p>'); } else { document.write('<p>you didnt earn anything</p>'); }

1 Answer

Steven Parker
Steven Parker
231,271 Points

When you check the fifth answer, you reference "questionfive" (lower-case "f") instead of "questionFive" (capital "F").

Marc Smolinski
Marc Smolinski
1,931 Points

OMG thank you soooo much can't believe i didn't see that!