Getting a return of a number between two values

Hello everyone
can anyone help me with my rock paper scissor game,
to return a if you lose outcome i keep getting error invalid left side assignment

else if(user = "rock" && computer = "paper" || user = "paper" && computer = "scissor" || user = "scissor" && computer = "rock" )
{
  return "you lose"

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

You are using = and I suspect you want ===

2 Likes

I am assuming you mean if user equals rock and computer equals paper, right?

If so, this is not the proper syntax for equals

This should help reviewing the difference between the assignment operator and equals.

Also you have a stray {

1 Like

Thank you guys I appreciate it
so far this is my code, when I console log I keep getting errors on the console log

var computerChoiceRan =Math.floor(Math.random() * 10);
function game(user, computer){
  function computer(choice2){
 if  (computerChoiceRan <= 3){
    choice2 = "scissor";}
  
 
 else if(computerChoiceRan >= 4  && computerChoiceRan<= 6 ){
    choice2 =  "rock";}

    else if (computerChoiceRan >= 7 && computerChoiceRan <= 9){
    choice2 = "paper";
   }
   return choice2;
  }
return computer;

if (user === computer ){
return "it's a draw"}

else if(user === "rock" && computer === "paper" || user === "paper" && computer === "scissor" || user === "scissor" && computer === "rock" )
{
  return "you lose"
}
else if(user === "rock" && computer === "scissor" || user === "paper" && computer === "rock" || user === "scissor" && computer === "paper" )

 
console.log(game('paper' ,computer));

The main reason why you are getting errors is because you missing some curly braces in a few places.

The formating of your code is a little unconventional and that is probably why it is hard for you to find these errors.

So the first step is to properly format your code.

Once you do that it will be easier to find and fix those errors.

Also, I am little bit confused by your use of computer.

So I think that is creating some errors too.