回答編集履歴
1
追記
test
CHANGED
@@ -37,3 +37,41 @@
|
|
37
37
|
document.write(ryoukin3(500,200));
|
38
38
|
|
39
39
|
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
[20/04/25追加] functionを一つに。
|
44
|
+
|
45
|
+
```html
|
46
|
+
|
47
|
+
<html>
|
48
|
+
|
49
|
+
<script type="text/javascript">
|
50
|
+
|
51
|
+
document.write("問2<br>");
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
function ryoukin(group,otona,kodomo){
|
56
|
+
|
57
|
+
baisu = { A:{otona:2,kodomo:4},B:{otona:1,kodomo:5},C:{otona:3,kodomo:7}}
|
58
|
+
|
59
|
+
return group+"グループは"+Number(otona*baisu[group].otona+kodomo*baisu[group].kodomo)+"です。";
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
document.write(ryoukin('A',500,200)+"<br>");
|
66
|
+
|
67
|
+
document.write(ryoukin('B',500,200)+"<br>");
|
68
|
+
|
69
|
+
document.write(ryoukin('C',500,200));
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</script>
|
74
|
+
|
75
|
+
</html>
|
76
|
+
|
77
|
+
```
|