loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var player1;
var player2;


var i = 0;
var max = 10;
while (i < max){
  
  player1 = parseFloat(prompt(" Player 1 Select 0. Rock 1. Scissors 2.paper"));
  player2 =  Math.floor(Math.random() * 4);

  if(player1 == 0 && player2 == 0){
  console.log("Draw");
  i+=1;
  }

  else if(player1 == 1 && player2 == 1){
  console.log("Draw");
  i+=1;
  }
 else if(player1 == 2 && player2 == 2){
  i+=1;
  console.log("Draw ");
  }
  else if (player1 == 1 && player2 == 2){
  i+=1;
  console.log("Player 1 wins");
  }
  else if (player1 == 2 && player2 == 1){
  i+=1;
  console.log("Player 2 wins");
  }
  else if(player1 == 0 && player2 == 1){
  i+=1;
  console.log("Player 1 wins");
  }
  else if(player1 == 1 && player2 == 0){
  i+=1;
  console.log("Player 2 wins");
  }
  else if(player1 == 0 && player2 == 2 ){
  i+=1;
  console.log("Player 2 wins");
  }
  else if(player1 == 2 && player2 == 0){
  i+=1;
  console.log("Player 1 wins");
  }
}
Fetching token