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

Sean Lopez
Sean Lopez
6,783 Points

Conditional Challange--The question prompts are not showing up in the preview. What am I missing?

//Quiz start
var correct=0;

//Ask questions

var answer1 = prompt ("Snoop last name");
  if (answer1.toUpperCase() === 'DOGG') {
      correct += 1;
  }

 var answer2= prompt ("What is the capital of Vietnam?");
  if (answer2.toUpperCase() === 'HANOI') {
     correct +=1;
  }

var answer3 = prompt ("When is the USA election day?");
 if (answer3.toUpperCase() === 'NOVEMBER 8TH') {
     correct +=1;
 }

var answer4 = prompt ("Who is the biggest ahole running for president of the USA?");
  if (answer4.toUpperCase () === 'TRUMP') {
     correct +=1; 
 }

var answer5 = prompt ("Who wrote Slaughterhouse 5?") ;
    if (answer5.toUpperCase () === 'VONNEGUT') {
       correct +=1; 
 }

   //Output results 

document.write ('<p> You got ' + correct  + ' out of five questions.</p>'); 
  //output rank
if ( correct ===5) {
   document.write ('<p><strong>You earned a gold crown!</strong></p>');
    } else if (correct >= 3 ) {
   document.write ('<p><strong>You earned a silver crown.</strong></p>');
    } else if (correct >=1) {
   document.write ('<p><strong>You earned a bronze crown.</strong></p>');
    } else { 
   document.write ('<p><strong>You know nothing, John Snow.</strong></p>');

1 Answer

Steven Parker
Steven Parker
231,271 Points

:white_check_mark: It runs fine for me.

I'm not sure why you wouldn't see the prompts. Have you tried a different browser?

Sean Lopez
Sean Lopez
6,783 Points

Thanks, Steven.

I'll try it out.

-Sean