-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (30 loc) · 846 Bytes
/
main.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
let getComputerChoice = ()=>{
let guessCount = 3;
let guessNo = Math.floor(Math.random() * guessCount + 1)
switch(guessNo){
case 1:
return "Rock";
case 2:
return "Paper";
case 3:
return "Scissors";
}
}
let computerCount = "";
let playerCount = "";
let playRound = (playerSelection, computerSelection)=>{
if(playerSelection.toLowerCase()===computerSelection.toLowerCase()){
console.log(computerSelection);
return "You smashed him";
} else {
console.log(computerSelection);
return "You Lose! Paper beats Rock"
}
}
let playerText = prompt("Rock, Paper or Scissors");
let game = playtimes=>{
for (let i = 1; i < 5; i++){
console.log(playtimes)
}
}
console.log(game(playRound(playerText, getComputerChoice())));