回答編集履歴
1
ちょい修正
answer
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
```javascript
|
2
2
|
const a=[ 0,220, 20, 340, 0, 340, 34, 64, 0, 32, 12, 0, 23];
|
3
|
-
const b=a.reduce((x,y)=>y===0?x.push([])
|
3
|
+
const b=a.reduce((x,y)=>y===0?(x.push([]),x):(x[x.length-1].push(y),x),[[]]);
|
4
4
|
console.log(b);
|
5
5
|
```
|