## 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. # Hi all, i can get mine to show "Gold," but no other ranks--suggestions? Will paste my code below...

```/*
- When quiz begins, no answers are correct
*/

let answer1guess = prompt("What is 1?");
let answer2guess = prompt("What is 2?");
let answer3guess = prompt("What is 3?");
let answer4guess = prompt("What is 4?");
let answer5guess = prompt("What is 5?");

let message;
let rank;
let finalMessage;

} else {
}

}else {
}
}else {
}
}else {
}
}else {
}

// 2. Store the rank of a player

message = 1;
message = 2;
message = 3;
message = 4;
message = 5;
}

// 3. Select the <main> HTML element

/*
4. Ask at least 5 questions
- Store each answer in a variable
- Keep track of the number of correct answers
*/

/*
5. Rank player based on number of correct answers
- 5 correct = Gold
- 3-4 correct = Silver
- 1-2 correct = Bronze
- 0 correct = No crown
*/

if (message = 5) {
rank = "Gold";
} else if (message = 3 || 4) {
rank = "Silver";
} else if (message = 1 || 2) {
rank = "Bronze";
} else {
rank = "No crown";
}

// 6. Output results to the <main> element
/*
Ex: "You got X out of 5 questions correct.
Crown earned: X"
*/

finalMessage = `<p>You got \${message} out of 5 questions correct.
Crown earned: \${rank}</p>`;
document.querySelector("main").innerHTML = finalMessage;
``` Note that a single "=" is an assignment, not a comparison. So "message" will always be 5 after this:

```if (message = 5) {
rank = "Gold";
```

Also note that "prompt" always returns a string, so a type-sensitive comparison like this one will always be false:

```if (answer1 === answer1guess) {
```

Finally, note that if the first test in an "else if" chain is true, no other tests will be done:

```if (answer1guess) {
message = 1;
```

So when answer 1 is correct, the count will always be 1. You will probably want to add up the count before testing it, since the first answer could be wrong but others might be right.