9/9 Can someone give me a little help? This is what it says: SyntaxError: Unexpected end of input


#1

var userChoice = prompt("Do you choose rock, paper, scissors or rope?");
var computerChoice = Math.random();
if (computerChoice < 0.25) {
computerChoice = "rock";
} else if(computerChoice <= 0.50) {
computerChoice = "paper";
} else if (computerChoice <=0.75){
computerChoice = "scissors";}
else { computerChoice = "rope";
} console.log("Computer: " + computerChoice);
var compare = function (choice1,choice2){
if (choice1 === choice2){
return "make another choice";
}
else if (choice1 === "rock") {
if(choice2 === "scissors") {
return "rock wins"; }
else if (choice2 === "paper"){
return "paper wins";}
else {return "rope wins";
}
}
else if (choice1==="paper"){
if (choice2==="rock") {
return "paper wins";}
else if (choice2==="scissors"){
return "scissors wins";}
else {return "paper wins";
}
}
else if (choice1 === "scissors") {
if (choice2 === "paper") {
return "scissors wins";}
else if(choice2==="rock"){
return "rock wins";}
else {return "rope wins";
}
}
else if (choice1==="rope"){
if (choice2==="scissors"){
return "rope wins";}
else if (choice2==="paper"){
return "paper wins";}
else {return "rope wins";} }
else if (choice2!=="rope" &"scissors"& "rock"&"paper"){
return "choose one of the four options";}
console.log(compare(userChoice,computerChoice));


#2

hey i think you forgot to close your compare function with }; before calling it on "console.log(compare(userChoice,computerChoice));"

let me know if that works


#3

Thanks for the answer ..But i did not anterstand what i do wrong. I thing i have close it.Thanks again


#4

you have right i closed end it works :else if (choice2!=="rope" &"scissors"& "rock"&"paper"){
return "choose one of the four options";}};
console.log(compare(userChoice,computerChoice));..Thank you