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

It does't work it says Uncaught SyntaxError: Unexpected end of input in the line 76

console.log("Program starts");
var punts=0;



var question=prompt("What is the biggest Country? ");

var answerOne=question.toLowerCase();

var question2=prompt("Is puerto rico in the US? ");

var answerTwo=question.toLowerCase();

var question3=prompt("What is the language use for Web apps ");

var answerThree=question.toLowerCase();

var question4=prompt("What is the capital of Russia");

var answerFour=question.toLowerCase();

var question5=prompt("What is the smallest country in the world");

var answerFive=question.toLowerCase();

if(answerOne==="Russia"){
  punts+=1;

}
else{
  punts -=1;
}
if(answerTwo==="Yes"){
punts +=1;
}
else{
  punts -=1;
}
if(answerThree==="JavaScript"){
  punts += 1;
}
else{
  punts -= 1;
}
if(answerFour==="Moscu"){
  punts +=1;
}
else{
  punts -=1;
}
if(answerFive==="Baticano"){
  punts +=1;
}
else{
  punts -=1;
}

if(punts===5){
  document.write("<h1>Congratulitions you got a gold medal</h1>");
}
if(punts===4){
   document.write("<h1>Congratulitions you got a silver medal</h1>"); 

if(punts===3){
  document.write("<h1>Congratulitions you got a silver medal</h1>");
   }
if(punts==2){
    document.write("<h1>Congratulitions you got a bronze medal</h1>");
  }
    if(punts===1){
      document.write("<h1>Sorry you didin't win any medal</h1>");
    } 

      if(punts===0){
      document.write("<h1>Sorry you didin't win any medal</h1>");
      }
    console.log("Program Ends");

2 Answers

Ioannis Leontiadis
Ioannis Leontiadis
9,828 Points

Hello Ignacio,

you have forgot to close the block of an if statement. Try,

if(punts===4){ 
    document.write("<h1>Congratulations you got a silver medal</h1>");
} // <-- important

Syntax errors are quite often and relate to things like that.

Ioannis Leontiadis thank you,