回答編集履歴
1
出力が質問と異なっていたので修正
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
const result = arr.reduce((result, value) => {
|
11
|
+
const result = [arr.reduce((result, value) => {
|
12
12
|
|
13
13
|
Object.keys(value).forEach(key =>
|
14
14
|
|
@@ -18,12 +18,12 @@
|
|
18
18
|
|
19
19
|
return result;
|
20
20
|
|
21
|
-
}, {});
|
21
|
+
}, {})];
|
22
22
|
|
23
23
|
|
24
24
|
|
25
25
|
console.log(JSON.stringify(result));
|
26
26
|
|
27
|
-
// => {"a":[1,4],"b":[2,5],"c":[3],"d":[6]}
|
27
|
+
// => [{"a":[1,4],"b":[2,5],"c":[3],"d":[6]}]
|
28
28
|
|
29
29
|
```
|