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

Here is my solution, I take any advice. Thanks!

1 Answer

This took me quite a while, and it's printing in 2 different fonts, but it runs. If anyone can reduce redundancies, please let me know.

var score = 0; var crowns = ''; var queryOne =prompt("Where is Lisbon?"); if (queryOne.toUpperCase() ==="PORTUGAL") { score +=1;
document.write("<p>You're awesome! It is Portugal.</p>") } else { document.write("</p>Well, at least you got the right planet.</p>") }

var queryTwo =prompt("What is Jupiter's largest moon?"); if (queryTwo.toUpperCase() ==="Ganymede") { score +=1;
document.write("<p>Wow! You really know the cosmos.</p>"); } else { document.write("<p>Oops. That's not the Jovian's giant satellite.</p>") }

var queryThree = prompt("This is a seven-dwarves question. If Dopey is sleepy, and Sleepy is grumpy, and Grumpy is Dopey, who still eats the poison apple?") if (queryThree.toUpperCase() ==="Snowwhite" || queryThree.toUpperCase() === "Snow White") { score +=1;
document.write("<p>Yay! Another Team Rodent fan!</p>") } else { document.write("<p>You missed that one. Better stay away from the orchard.</p>") }

var queryFour = prompt("What is the arm of a sundial called?"); if (queryFour.toUpperCase() === "gnomon") { score +=1;
document.write("<p>You're all about the temporal continuum!</p>") } else { document.write("<p>Gnomon, you got it wrong.</p>"); }

var queryFive = prompt("Who wrote 'Bridge of Birds'?"); if (queryFive.toUpperCase() === "HUGHART" || queryFive.toUpperCase() === "Barry Hughart") { score +=1;
document.write("<p>Please exchange this for a feather. The birds must fly.</p>") } else { document.write("No. Beware the Duke of Chin.") } if (score = 5) {crown = "gold"} else if (score = 4 ||3 ) {crown = "silver"} else if (score = 1|| 2) {crown = "paper"} document.write("<p>You got " + score + "correct. You get a " + crown + " crown. </p>")