回答編集履歴
1
code
test
CHANGED
@@ -1 +1,25 @@
|
|
1
1
|
乱数を生成し、値に応じて出す手を変えればよいのではないでしょうか
|
2
|
+
|
3
|
+
```javascript
|
4
|
+
|
5
|
+
var random = Math.floor(Math.random()*3);
|
6
|
+
|
7
|
+
var hand = ["グー","パー","チョキ"];
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
if( random == 0 ){
|
12
|
+
|
13
|
+
document.write(hand[0]);
|
14
|
+
|
15
|
+
}else if( random == 2 ){
|
16
|
+
|
17
|
+
document.write(hand[1]);
|
18
|
+
|
19
|
+
}else{
|
20
|
+
|
21
|
+
document.write(hand[2]);
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
```
|