## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today. # Here is my attempt at the conditional statements quiz

Hey guys,

Wondering if there is anything I can do to improve this.

```/* Asks User Questions
Determines if Answer is Right or Wrong
Prints to Screen How Many Answers Correct
Gives Crown Based on Performance */

var questionOne = prompt('Is this question one?');
var questionTwo = prompt('Is this question two?');
var questionThree = prompt('Is this question three?');
var questionFour = prompt('Is this question four?');
var questionFive = prompt('Is this question five?');
var score = 0;

// Question Check
if (questionOne.toUpperCase() === 'YES') {
score += 1;
}
else if (questionTwo.toUpperCase() === 'YES') {
score += 1;
}
else if (questionThree.toUpperCase() === 'YES') {
score += 1;
}
else if (questionFour.toUpperCase() === 'YES') {
score += 1;
}
else if (questionFive.toUpperCase() === 'YES') {
score += 1;
}

// end of quiz

document.write('<p>You got ' + score + ' questions correct!</p>');

// assigning of crown
if (score === 5) {
document.write('Here is a gold crown');
}
else if (score === 4 || score === 3) {
document.write('Here is a silver crown');
}
else if (score === 2 || score === 1) {
document.write('Here is a bronze crown');
}
else {
document.write('You get no crown');
}
``` Looks like a simple and easy quiz generator. Nice Job. How about adding some trivia questions and having your friends try it out?

Nice work!!

Here is mine:

```//5 Quesiton QUIZ

var goldCrown;
var silverCrown;
var bronzeCrown;
var questions = 5;

//Question 1

var answer = prompt("TRUE or FALSE , I am a computer? " + questions + " questions left.")
document.write("<h2> Question 1 CORRECT</h2>");
questions = questions -1;
}
else {
document.write("<h2> Question 1 WRONG </h2>");
questions = questions -1;
}

//Question 2

var answer = prompt("TRUE or FALSE , I am a computer " + questions + " questions left.")
document.write("<h2> Question 2 CORRECT</h2>");
questions = questions -1;
}
else {
document.write("<h2> Question 2 WRONG </h2>");
questions = questions -1;
}

//Question 3

var answer = prompt("TRUE or FALSE , I am a computer " + questions + " questions left.")
document.write("<h2> Question 3 CORRECT</h2>");
questions = questions -1;
}
else {
document.write("<h2> Question 3 WRONG </h2>");
questions = questions -1;
}

//Question 4

var answer = prompt("TRUE or FALSE , I am a computer " + questions + " questions left.")
document.write("<h2> Question 4 CORRECT</h2>");
questions = questions -1;
}
else {
document.write("<h2> Question 4 WRONG </h2>");
questions = questions -1;
}

//Question 5

var answer = prompt("TRUE or FALSE , I am a computer " + questions + " questions left.")
document.write("<h2> Question 5 CORRECT</h2>");
questions = questions -1;
}
else {
document.write("<h2> Question 5 WRONG </h2>");
questions = questions -1;
}

// Correct Message Output
document.write("<h2> You got " + correctAnswers + " right!</h2>");

//Reward "CROWN" Code

if( correctAnswers === 5 ) {
document.write("<h2> YOU EARNED A GOLD CROWN</h2>");
}
else if ( correctAnswers >= 3) {
document.write("<h2> YOU EARNED A SILVER CROWN</h2>");
}
else {
document.write("<h2> YOU EARNED A BRONZE CROWN</h2>");
}
```