回答編集履歴

1

テキスト修正

2019/12/18 05:40

投稿

jun68ykt
jun68ykt

スコア9058

test CHANGED
@@ -12,17 +12,21 @@
12
12
 
13
13
  var arr2 = arr.reduce(
14
14
 
15
- (a, e) => a[a.length-1].length === 4 ?
15
+ (a, e, i) => i % 4 ?
16
16
 
17
- [...a, [e]] : [...a.slice(0, a.length-1), [...a[a.length-1], e] ]
17
+ [...a.slice(0, a.length-1), [...a[a.length-1], e] ]
18
18
 
19
+ :
20
+
21
+ [...a, [e]]
22
+
19
- ,[[]]
23
+ ,[]
20
24
 
21
25
  )
22
26
 
23
27
  ```
24
28
 
25
- - 動作確認用 CodePen: [https://codepen.io/jun68ykt/pen/JjoERKx?editors=0012](https://codepen.io/jun68ykt/pen/JjoERKx?editors=0012)
29
+ - 動作確認用 CodePen: [https://codepen.io/jun68ykt/pen/dyPNpEM?editors=0012](https://codepen.io/jun68ykt/pen/dyPNpEM?editors=0012)
26
30
 
27
31
 
28
32