回答編集履歴
1
追記
test
CHANGED
@@ -2,8 +2,22 @@
|
|
2
2
|
|
3
3
|
const samples = [[0,1,2],[3,4,5],[6,7,8]];
|
4
4
|
|
5
|
-
const result = samples.map(x=>x.filter(x=>x%2==0))
|
5
|
+
const result = samples.map(x=>x.filter(x=>x%2==0));
|
6
6
|
|
7
7
|
console.log(result);
|
8
8
|
|
9
9
|
```
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
# 結果を一次配列で
|
14
|
+
|
15
|
+
```javascript
|
16
|
+
|
17
|
+
const samples = [[0,1,2],[3,4,5],[6,7,8]];
|
18
|
+
|
19
|
+
const result = samples.flat().filter(x=>x%2==0);
|
20
|
+
|
21
|
+
console.log(result);
|
22
|
+
|
23
|
+
```
|