Advertisement
Guest User

rps

a guest
Oct 6th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var userChoice = prompt("Do you choose rock, paper or scissors?")
  2. computerChoice = Math.random(0, 1)
  3.  
  4.  
  5. if (computerChoice <= 0.33 && computerChoice > 0)
  6. {
  7.     computerChoice = "Rock";
  8. }
  9.  
  10. else if (computerChoice < 0.66 && computerChoice > 0.34)
  11. {
  12.     computerChoice = "Paper";
  13. }
  14.  
  15. else if (computerChoice < 1 && computerChoice > 0.67)
  16. {
  17.     computerChoice = "Scissors";
  18. }
  19. console.log (computerChoice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement