回答編集履歴

3

ついき

2018/09/21 06:47

投稿

yambejp
yambejp

スコア114839

test CHANGED
@@ -89,3 +89,61 @@
89
89
  }
90
90
 
91
91
  ```
92
+
93
+
94
+
95
+ # 切り捨ててからカンマをつける
96
+
97
+ ```javascript
98
+
99
+ document.querySelector('#ansall').innerHTML = word +("\n")+
100
+
101
+ [
102
+
103
+ {val:ans1 ,text:wordx1+conma.format(Math.floor(ans1))},
104
+
105
+ {val:ans2 ,text:selecas==2?'':(wordx2+conma.format(Math.floor(ans2)))},
106
+
107
+ {val:ans3 ,text:wordx3+conma.format(Math.floor(ans3))},
108
+
109
+ {val:ans4 ,text:selecas==2?'':(wordx4+conma.format(Math.floor(ans4)))},
110
+
111
+ {val:ans5 ,text:wordx5+conma.format(Math.floor(ans5))},
112
+
113
+ {val:ans6 ,text:selecas==2?'':(wordx6+conma.format(Math.floor(ans6)))},
114
+
115
+ {val:ans7 ,text:wordx7+conma.format(Math.floor(ans7))},
116
+
117
+ {val:ans8 ,text:selecas==2?'':(wordx8+conma.format(Math.floor(ans8)))},
118
+
119
+ {val:ans9 ,text:wordx9+conma.format(Math.floor(ans9))},
120
+
121
+ {val:ans10,text:selecas==2?'':(wordx10+conma.format(Math.floor(ans10)))},
122
+
123
+ {val:ans11,text:wordx11+conma.format(Math.floor(ans11))},
124
+
125
+ {val:ans12,text:selecas==2?'':(wordx12+conma.format(Math.floor(ans12)))},
126
+
127
+ {val:ans13,text:wordx13+conma.format(Math.floor(ans13))},
128
+
129
+ {val:ans14,text:selecas==2?'':(wordx14+conma.format(Math.floor(ans14)))},
130
+
131
+ {val:ans15,text:wordx15+conma.format(Math.floor(ans15))},
132
+
133
+ ].filter(function(x){
134
+
135
+ return x.text.match(/\d/);
136
+
137
+ }).sort(function(x,y){
138
+
139
+ return x.val>y.val?1:-1;
140
+
141
+ }).map(function(x){
142
+
143
+ return x.text
144
+
145
+ }).join("\n");
146
+
147
+ }
148
+
149
+ ```

2

修正

2018/09/21 06:47

投稿

yambejp
yambejp

スコア114839

test CHANGED
@@ -74,7 +74,11 @@
74
74
 
75
75
  }).sort(function(x,y){
76
76
 
77
+ /* return x.val>y.val; */ //訂正
78
+
77
- return x.val>y.val
79
+ return x.val>y.val?1:-1;
80
+
81
+ }).map(function(x){
78
82
 
79
83
  }).map(function(x){
80
84
 

1

調整

2018/09/21 06:40

投稿

yambejp
yambejp

スコア114839

test CHANGED
@@ -29,3 +29,59 @@
29
29
 
30
30
 
31
31
  拡張する予定があるなら、データの持ち方をかえてください
32
+
33
+
34
+
35
+ ```javascript
36
+
37
+ document.querySelector('#ansall').innerHTML = word +("\n")+
38
+
39
+ [
40
+
41
+ {val:ans1 ,text:wordx1+conma.format(ans1)},
42
+
43
+ {val:ans2 ,text:selecas==2?'':(wordx2+conma.format(ans2))},
44
+
45
+ {val:ans3 ,text:wordx3+conma.format(ans3)},
46
+
47
+ {val:ans4 ,text:selecas==2?'':(wordx4+conma.format(ans4))},
48
+
49
+ {val:ans5 ,text:wordx5+conma.format(ans5)},
50
+
51
+ {val:ans6 ,text:selecas==2?'':(wordx6+conma.format(ans6))},
52
+
53
+ {val:ans7 ,text:wordx7+conma.format(ans7)},
54
+
55
+ {val:ans8 ,text:selecas==2?'':(wordx8+conma.format(ans8))},
56
+
57
+ {val:ans9 ,text:wordx9+conma.format(ans9)},
58
+
59
+ {val:ans10,text:selecas==2?'':(wordx10+conma.format(ans10))},
60
+
61
+ {val:ans11,text:wordx11+conma.format(ans11)},
62
+
63
+ {val:ans12,text:selecas==2?'':(wordx12+conma.format(ans12))},
64
+
65
+ {val:ans13,text:wordx13+conma.format(ans13)},
66
+
67
+ {val:ans14,text:selecas==2?'':(wordx14+conma.format(ans14))},
68
+
69
+ {val:ans15,text:wordx15+conma.format(ans15)},
70
+
71
+ ].filter(function(x){
72
+
73
+ return x.text.match(/\d/);
74
+
75
+ }).sort(function(x,y){
76
+
77
+ return x.val>y.val
78
+
79
+ }).map(function(x){
80
+
81
+ return x.text
82
+
83
+ }).join("\n");
84
+
85
+ }
86
+
87
+ ```