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

My Solution (Feedback please)

//make a quiz game
//first question
var score = 0;
var firstQ = prompt('What does FCC stand for?');
if (firstQ.toLowerCase()==='free code camp') {
    document.write('<h3>1\) Correct!</h3>');
    if (firstQ) {
        score += 20;
    }
} else { 
    document.write('<h6>Sorry, that\'s incorrect</h6>');
} 
//second question
var secondQ = prompt('What is the shorthand for regular expressions?');
if (secondQ.toLowerCase()==='regex') {
    document.write('<h3>2\) Correct!</h3>');
    if (secondQ){
        score += 20;
    }
} else {
    document.write('<h6>Sorry, that\'s incorrect</h6>');
}
//third question
var thirdQ = prompt('In JavaScript, what does \'var\' stand for?');
if (thirdQ.toLowerCase()==='variable'){
    document.write('<h3>3\) Correct!</h3>');
    if (thirdQ) {
        score += 20;
    }
}
//fourth question
var fourthQ = prompt('Success is my only motherfucking option, \"     \" NOT');
if (fourthQ.toLowerCase()=== 'failure\'s') {
    document.write('<h3>4\) ticka ticka slim shady!</h3>');
    if (fourthQ) {
        score += 20;
    }
}
// fifth question
var fifthQ = prompt('\"Kids should be allowed to break stuff more often. That\'s a consequence of exploration. Exploration is what you do when you don\'t know what you\'re doing.\" Is a quote by who?');
if (fifthQ === 'Niel Degrasse Tyson' || 'Niel Tyson') {
    document.write('<h3>The sagan saga continues....</h3>');
    if (fifthQ) {
        score += 20;
    }
}

//points and rewards
if (score === 100) {
    document.write('<h1>Congratulations, your score is ' + score +' and you get a GOLD crown.</h1>');
} else if (score > 60) {
    document.write('<h2>Congratulations, your score is ' + score +' and you get a SILVER crown.</h2>');
} else if (score > 20) {
    document.write('<h3>You scored a ' + score +' and got a bronze crown. You pretty much suck.</h3>');
} else {
    document.write('<h6>You got them all wrong. your score is ' + score + ' you get nothing.</h6>');
}
Gunhoo Yoon
Gunhoo Yoon
5,027 Points

Goob job! but do you need nested if statement for your questions?

Hey thanks, your right. so much extra code!