Is it a error at my code, can you help me, please?


#1

/*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 = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);*/

var userChoice1=prompt("Do you choose rock,paper or scissors?");{
console.userChoice1=console.log("Do you choose rock,paper or scissors?");
}

var computerChoice1=Math.random();{
console.log(computerChoice);

if (computerChoice1 < 0.34) {
computerChoice1 = "rock";
}
else if (computerChoice1 <= 0.67) {
computerChoice1 = "paper";
}
else {
computerChoice1 = "scissors";
}

}
var userChoice2=prompt("Do you choose rock,paper or scissors?");{
console.userChoice2=console.log("Do you choose rock,paper or scissors?");
}
var computerChoice2=Math.random();{
console.log(computerChoice2);

if (computerChoice2 < 0.34) {
computerChoice2 = "rock";
}
else if (computerChoice2 <= 0.67) {
computerChoice2 = "paper";
}
else {
computerChoice2 = "scissors";
}
}
var compare = function(computerChoice1, computerChoice2){
if(computerChoice1 === computerChoice2){
return "The result is a tie";


#2

You can't do this:

var userChoice1=prompt("Do you choose rock,paper or scissors?");{
    console.userChoice1=console.log("Do you choose rock,paper or scissors?");
}

userChoice1 is a variable, not a loop/function. And why do you have a userChoice2? What? What? is this even part of the exercises? What are you trying to do? The more i look at your code, the more confused i become.


#3

You also need to remove the /* and */ in your code, otherwise the computer processes it as a comment.


#4

I thought that I needed a loop, because i didn't understand this part of the code doing.
But now i get it.

Thanks a lot for all the comments.

I'm here for learning, so any comment and this forum help me a lot.

:relaxed: