-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript1.js
More file actions
31 lines (27 loc) · 861 Bytes
/
Copy pathscript1.js
File metadata and controls
31 lines (27 loc) · 861 Bytes
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
let person= prompt('What will it be? Rock, Paper, or Scissors.')
console.log(person);
person = person.toUpperCase()
console.log(person);
//let options= ['ROCK', 'PAPER', 'SCISSORS'];
let computer= [Math.floor(Math.random()*3)+1]
console.log(computer);
if (computer == 1) {
computer = 'ROCK';
} else if (computer == 2) {
computer = 'PAPER';
} else if (computer == 3) {
computer = 'SCISSORS';
} else {computer = 'No true statements'}
console.log(computer)
function playGame(peep, comp) {
if (peep === comp){
console.log("Tie");
}else if(
(peep === "ROCK" && comp === "SCISSORS") ||
(peep === "PAPER" && comp === "ROCK") ||
(peep === "SCISSORS" && comp === "PAPER")){
console.log('Human wins this round')
}else {
console.log('Skynet wins this round')}
}
playGame(person, computer);