I need helb 3


#1


I do not understand what I've done wrong


`

Replace this line with your code.
var userChoice = prompt ( "Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if
( computerChoice >= 0,34){
computerChoice = "Rock";
}
else if
( computerChoice < 0,67){
computerChoice ="scissor";
}
else
(computerChoice < 0,96){
computerChoice="paper";
}
console.log("Computer: " + computerChoice);
console.log("User:" + userChoice);
choice1 = UserCoice;
choice2 = computerCoice;
var compare = function (choice1, choice2);
}
}
if (choice1 === choice2){
return "The result is a tie!";
else if (choice1==="rock"){
if (choice2 === "scissors"){
return "rock winn";
}
else {
return "paper winn";
}
}
else if (choice1==="scissors"){
if (choice2==="paper"){
return "scissors winn";
}
else{
return "paper winn";
}
}
else if (choice==="paper"){
if (choice==="rock"){
return "paper winn";
}
else{
return " scissors winn";
}
}


#2

I think you'll need to describe the problem first - along with what information you need/what's stopping you from continuing


#3

var userChoice = prompt ( "Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if
( computerChoice >= 0,34){
computerChoice = "Rock";
}
else if
( computerChoice < 0,67){
computerChoice ="scissor";
}
else
(computerChoice < 0,96){
computerChoice="paper";
}
console.log("Computer: " + computerChoice);
console.log("User:" + userChoice);
choice1 = UserCoice;
choice2 = computerCoice;
var compare = function (choice1, choice2)
}
if (choice1 === choice2)
return "The result is a tie!";
else if (choice1==="rock"){
if (choice2 === "scissors"){
return "rock winn";
}
else {
return "paper winn";
}
}
else if (choice1==="scissors"){
if (choice2==="paper"){
return "scissors winn";
}
else{
return "paper winn";
}
}
else if (choice==="paper"){
if (choice==="rock"){
return "paper winn";
}
else{
return " scissors winn";
}
}


#4

I will print out : SyntaxError: Unexpected token {


#5

Thank you for helping


#6

If you've got firefox installed, try running the code in its scratchpad (shift f4) - it'll give you a better error message (at the very least you'll get a line number for where the unexpected ( is

Or in chrome (slightly harder to find): f12 -> sources -> snippets -> new snippets

There are websites as well where you can run js which will also give you better error messages. But you've already got a js interpreter in your browser


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.