Rock Paper Scissors Not Working


Can someone help me with this code?I’m trying to figure out what is wrong. I know that there must be some bug because I’m not able to really complete the first part of the challenge. I used userInput instead of the prompt “Do you choose rock, paper or scissors?”. Any feedback would be great.


var userChoice=prompt(userInput=>userInput)
var computerChoice=Math.random()

if (computerChoice<0.34){
else if (computerChoice<0.67){

else (computerChoice=1){



prompt is a function that takes at most two arguments, and both of them string expressions.

var user = prompt("Enter a number from 1 to 10", '5');

The above will return '5' if Enter is pressed with no input from the user. It’s the default return value that we can write into the arguments.

Since this is Rock, Paper, Scissors, the prompt string can be something like,

"Do you choose 'rock', 'paper', or 'scissors'?"

For this exercise I don’t think a default value is expected so it can be left off.


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