Advertisement
KeeJayBe

Blad Steen Schaar

Feb 15th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const keuzeGebruiker = prompt("Wat kies je? blad, steen schaar?");
  2. let keuzeComputer = Math.random();
  3.  
  4. if(keuzeComputer <= 0.33){
  5.     keuzeComputer = "Blad";
  6. }else if(keuzeComputer <= 0.66){
  7.     keuzeComputer = "Steen";
  8. }else {
  9.     keuzeComputer = "Schaar";
  10. }
  11.  
  12. if(keuzeComputer == keuzeGebruiker ){
  13.     alert("Gelijkstand");
  14. }
  15.  
  16. if((keuzeComputer == "Steen" && keuzeGebruiker == "Blad")||(keuzeComputer == "Blad" && keuzeGebruiker == "Schaar")||(keuzeComputer == "Schaar" && keuzeGebruiker == "Steen")){
  17.     alert("Jij wint!")
  18. }else{
  19.     alert("De pc wint!")
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement