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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![simsima](https://secure.gravatar.com/avatar/df07c946083e3ad6b268f1dd99320d94?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
simsima
Courses Plus Student 2,560 PointsThis isn't adding up
/*
1. Store correct answers
- When quiz begins, no answers are correct
*/
let correctAnswer = 0
// 2. Store the rank of a player
let rank;
// 3. Select the <main> HTML element
const main = document.querySelector('main');
/*
4. Ask at least 5 questions
- Store each answer in a variable
- Keep track of the number of correct answers
*/
const q1 = prompt(` Are multi-line comments started and ended with " /* */ " `);
if (q1.toUpperCase() === 'YES' || q1.toUpperCase() === 'Y'){
correctAnswer +=1;
console.log(correctAnswer);
}
const q2 = prompt(` Are single comments started and ended with " // " `);
if (q2.toUpperCase() === 'YES' || q1.toUpperCase() === 'Y'){
correctAnswer +=1;
console.log(correctAnswer);
}
const q3 = prompt(` Are you learning JavaScript ???" `);
if (q3.toUpperCase() === 'YES' || q1.toUpperCase() === 'Y'){
correctAnswer +=1;
console.log(correctAnswer);
}
const q4 = prompt(`Does this quiz suck ???`);
if (q4.toUpperCase() === 'YES' || q1.toUpperCase() === 'Y'){
correctAnswer +=1;
console.log(correctAnswer);
}
const q5 = prompt(` are we done yet ????`); \\jokes
if (q5.toUpperCase() === 'YES' || q1.toUpperCase() === 'Y'){
correctAnswer +=1;
console.log(correctAnswer);
}
/*
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 ( correctAnswer === 5){
rank =`👑👑👑👑👑 Gold`;
} else if( correctAnswer >= 3 ) {
rank =`👑👑👑 Silver`;
} else if( correctAnswer >= 2 ){
rank =`👑👑 Bronze`;
} else
rank = `No Crown`;
// 6. Output results to the <main> element
let results = `<p> The results is you got ${rank}</p>`;
main.innerHTML = results;
1 Answer
![Bella Bradbury](https://uploads.teamtreehouse.com/production/profile-photos/11669503/micro_Bella_Bradbury_8x10a.jpg)
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsI'm looking into this issue, but you've posted your question twice. I will respond on the other question, please mark this "answer" as the best answer on this post to avoid any confusion!
Steven Parker
230,688 PointsSteven Parker
230,688 PointsA better way to handle a duplicate is to delete it by clicking the little rectangle with the 3 dots to reveal the option to "Delete Question". But only questions with no answers can be deleted, so you'll need to delete this "answer" first to allow the asker to delete the question!
In future, notify an asker of a duplicate using a comment instead of an "answer".![:see_no_evil: :see_no_evil:](https://image-proxy-cdn.teamtreehouse.com/7e2cd972ef43a6ce7020c3a945ab8eae1b163900/68747470733a2f2f7374617469632e7465616d74726565686f7573652e636f6d2f696d616765732f656d6f6a692f756e69636f64652f31663634382e706e67)