回答編集履歴
1
テキスト修正
test
CHANGED
@@ -23,3 +23,29 @@
|
|
23
23
|
```
|
24
24
|
|
25
25
|
- **動作確認用 CodePen:** [https://codepen.io/jun68ykt/pen/pooOZbR?editors=0012](https://codepen.io/jun68ykt/pen/pooOZbR?editors=0012)
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
### 追記
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
別の方法を挙げます。(与えられた配列を `data` とします。)
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
[
|
40
|
+
|
41
|
+
...data.filter(e => e === 3),
|
42
|
+
|
43
|
+
...data.filter(e => e !== 3).sort((a,b) => a - b)
|
44
|
+
|
45
|
+
]
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
- **動作確認用CodePen:** [https://codepen.io/jun68ykt/pen/QWWVZEP?editors=0012](https://codepen.io/jun68ykt/pen/QWWVZEP?editors=0012)
|