-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge.html
More file actions
48 lines (36 loc) · 1.8 KB
/
challenge.html
File metadata and controls
48 lines (36 loc) · 1.8 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<p id="target"></p>
<script>
// document.querySelector('#target').innerHTML = 'Hey Guys'
const p1 = prompt ('Player 1! rock, paper or scissors?');
const p2= prompt ('Player 2! rock, paper or scissors?');
if (p1.toLowerCase () === "rock" && p2.toLowerCase() === 'paper'){
document.querySelector('#target').innerHTML = 'P2 Wins'
} else if (p1.toLowerCase () === "rock" && p2.toLowerCase() === 'scissors'){
document.querySelector('#target').innerHTML = 'P1 Wins'
} else if (p1.toLowerCase () === "rock" && p2.toLowerCase() === 'rock'){
document.querySelector('#target').innerHTML = 'NobodyWins'
} else if (p1.toLowerCase () === "scissors" && p2.toLowerCase() === 'rock'){
document.querySelector('#target').innerHTML = 'P2 Wins'
} else if (p1.toLowerCase () === "scissors" && p2.toLowerCase() === 'paper'){
document.querySelector('#target').innerHTML = 'P1 Wins'
} else if (p1.toLowerCase () === "scissors" && p2.toLowerCase() === 'scissors'){
document.querySelector('#target').innerHTML = 'NobodyWins'
} else if (p1.toLowerCase () === "paper" && p2.toLowerCase() === 'rock'){
document.querySelector('#target').innerHTML = 'P1 Wins'
} else if (p1.toLowerCase () === "paper" && p2.toLowerCase() === 'paper'){
document.querySelector('#target').innerHTML = 'NobodyWins'
} else if (p1.toLowerCase () === "paper" && p2.toLowerCase() === 'scissors'){
document.querySelector('#target').innerHTML = 'P2 Wins'
}
</script>
</body>
</html>