I cant seem to get it to choose anything but scissors


#1

Keeps playing scissors


var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log (computerChoice)


if ( computerChoice <= 0.33 )
 {
 computerChoice = "Rock";
}

 else if ( computerChoice <= 0.66 )
 {
 computerChoice = "paper";
}

 else ( computerChoice <= 1 )
 {
 computerChoice = "scissors"
}
console.log (computerChoice)


#2

Else statements don't take a condition. Only if and else if statements use conditions. Else statements will execute if previous statement conditions haven't been met.


#3

thanks very much ! didn't know that was a thing, all changed and now it works ! =D


#4

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