Guest User

Untitled

a guest
Apr 29th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. var userChoice = prompt("Do you choose rock,paper or scissor?");
  2. var computerChoice = Math.random();
  3. console.log(computerChoice);
  4. if(computerChoice >=0 && computerChoice <=0.33) {
  5. console.log("rock");
  6. }
  7. else if(computerChoice>=0.34 && computerChoice <=0.66) {
  8. console.log("paper");
  9. }
  10. else {
  11. console.log("scissor");
  12. }
Advertisement
Add Comment
Please, Sign In to add comment