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
51
var playerCount = 0;
var computerCount = 0;
for(var i = 0; i <= 3; i++){
  var computerPlay = Math.random() * 10 + 1;
  if(computerPlay <= 3){
    var computerC = "rock";

  }
  else if(computerPlay > 3 && computerPlay <= 6){
    var computerC = "paper";

  }
  else{
    var computerC = "scissors";
  }

  var userC = prompt("rock, paper, or scissors? ");

  if(computerC == "rock" && userC == "scissors"){
    console.log("the computer won");
    computerCount++;
  }
  else if(computerC == "paper" && userC == "rock"){
    console.log("the computer won");
    computerCount++;
  }
  else if(computerC == "scissors" && userC =="paper"){
    console.log("the computer won");
    computerCount++;
  }
  else if(computerC == userC){
    console.log("tie");
  }
  else{
    console.log("the player won");
    playerCount++;
  }

  
}
console.log("player's score: " + playerCount + " computer's score " + computerCount);
  if(computerCount > playerCount){
    console.log("the computer wins!");
  }
  else if(computerCount < playerCount){
    console.log("the player wins!");
  }
  else{
    console.log("it was a tie!");
  }
Fetching token