|
3 | 3 | <head>
|
4 | 4 | <link href="css/style.css" rel="stylesheet" type="text/css">
|
5 | 5 | <script>
|
6 |
| - var userName = prompt("What is your name, puny human?"); |
7 |
| - |
8 |
| - var userChoice = prompt("Do you choose rock, paper, or scissors?"); |
9 |
| - |
10 |
| - var computerChoice = Math.random(); |
11 |
| - |
12 |
| - if (computerChoice <= 0.33) { |
13 |
| - computerChoice = "rock"; |
14 |
| - } else if (computerChoice <= 0.66) { |
15 |
| - computerChoice = "paper"; |
16 |
| - } else { |
17 |
| - computerChoice = "scissors"; |
18 |
| - } |
19 |
| - |
20 |
| - var compare = function(userChoice, computerChoice) { |
21 |
| - if (userChoice === computerChoice) { |
22 |
| - window.alert("The result is a tie!"); |
23 |
| - } else if(userChoice ==="rock") { |
24 |
| - if (computerChoice==="scissors") { |
25 |
| - |
26 |
| - window.alert("Rock wins!"); |
27 |
| - } else { |
28 |
| - window.alert("Paper wins"); |
29 |
| - } |
30 |
| - } |
31 |
| - else if(userChoice==="paper") { |
32 |
| - if(computerChoice ==="rock") { |
33 |
| - window.alert("Paper wins!"); |
34 |
| - } else { |
35 |
| - window.alert("scissors wins!"); |
36 |
| - } |
37 |
| - } |
38 |
| - |
39 |
| - else if(userChoice==="scissors") { |
40 |
| - if (computerChoice==="rock") { |
41 |
| - window.alert("Scissors wins!"); |
42 |
| - } else { |
43 |
| - window.alert("scissors wins"); |
44 |
| - } |
45 |
| - } |
46 |
| - }; |
| 6 | + <!-- put your JavaScript code here for now --> |
47 | 7 | </script>
|
48 | 8 | </head>
|
49 | 9 | <body>
|
50 | 10 | <h1>Learn to Code JavaScript</h1>
|
51 | 11 | <h4>If you see a white button below, you're in good shape!</h4>
|
52 | 12 | <div class="wrapper">
|
53 |
| - <button class="button" onclick="compare(userChoice, computerChoice);">LET'S PLAY Rock, Paper, Scissors!</button> |
| 13 | + <!-- put your JavaScript button here! --> |
54 | 14 | </div>
|
55 | 15 | <div>
|
56 | 16 | <h3>Brought to you by your friends at <a href="http://galvanize.com">Galvanize</a>.</h3>
|
|
0 commit comments