Making a console rock, paper scissors game [closed]

5 days ago 6
ARTICLE AD BOX

Hi so I’m learning JavaScript and having issues with my Rock paper scissors game.

When I press enter in my console for the user to input their choice the input box pops out twice and the console always gives the wrong answer

I could put rock and the computer would put scissors and it’ll say it’s a draw.

I’m so lost here I would appreciate the help and break down so I can solve the issue

It’s a console game so no html but this is my JavaScript

var humanScore = 0; var computerScore = 0; function getComputerChoice (){ var options = { [1] : "Rock", [2] : "Paper", [3] : "Scissors" } const randomChoice = Math.floor(Math.random() * 3 + 1); var options = options[randomChoice]; console.log(options); } function getHumanChoice() { var humanOption = prompt("what is your choice"); } function playRound(humanChoice, computerChoice) { if (getHumanChoice() === getComputerChoice ()){ console.log ("it's a DRAW"); } else if (getHumanChoice() ==="rock" & getComputerChoice () ==="Scissors"){ humanScore = humanScore + 1; console.log ("you WIN Rock crushes Scissors"); } else if (getHumanChoice() === "scissors" & getComputerChoice () ==="Rock"){ computerScore = computerScore + 1; console.log ("you LOSE Rock crushes Scissors"); } else if (getHumanChoice() ==="paper" & getComputerChoice () ==="Rock"){ humanScore = humanScore + 1; console.log ("you WIN paper Wraps rock"); } else if (getHumanChoice() === "rock" & getComputerChoice () ==="Paper"){ computerScore = computerScore + 1; console.log ("you LOSE paper Wraps rock"); } else if (getHumanChoice() === "paper" & getComputerChoice () ==="Scissors"){ computerScore = computerScore + 1; console.log ("you LOSE Scissors cuts Paper"); } else (getHumanChoice() === "scissors" & getComputerChoice () ==="Paper") humanScore = humanScore + 1; console.log ("you WIN Scissors cuts Paper"); } const humanSelection = getHumanChoice(); const computerSelection = getComputerChoice(); playRound(humanSelection, computerSelection);
Read Entire Article