回答編集履歴
1
追記
test
CHANGED
@@ -11,3 +11,33 @@
|
|
11
11
|
// ["aaa", "bbb", "ccc", "aaa", "bbb", "ccc", "aaa", "bbb", "ccc"]
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
map を使う場合、forEach と同じ使い方になり、返却値が無意味になってしまいます。
|
18
|
+
|
19
|
+
```javascript
|
20
|
+
|
21
|
+
const hoge2 = []
|
22
|
+
|
23
|
+
for ( ary of list ) { hoge2.push(...ary) };
|
24
|
+
|
25
|
+
console.log( hoge2 );
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
const hoge3 = []
|
30
|
+
|
31
|
+
list.forEach( ary => hoge3.push(...ary) );
|
32
|
+
|
33
|
+
console.log( hoge3 );
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
const hoge4 = []
|
38
|
+
|
39
|
+
list.map( ary => hoge4.push(...ary) );
|
40
|
+
|
41
|
+
console.log( hoge4 );
|
42
|
+
|
43
|
+
```
|