// 自己实现
function chunk(list, size) {
let len = list.length;
if (size < 1 || !...}
if (rest) {
res.push(list.splice(0, rest));
}
return res;
}
// console.log(chunk...([1, 2, 3, 4, 5], 0));
console.log(chunk([1, 2, 3, 4, 5], -1));
console.log(chunk([1, 2, 3, 4, 5], 2)...);
console.log(chunk([1, 2, 3, 4, 5], 3));
console.log(chunk([1, 2, 3, 4, 5], 4));
console.log(chunk(...[1, 2, 3, 4, 5], 5));
console.log(chunk([1, 2, 3, 4, 5], 6));
// []
// []
// [ [ 1, 2 ], [ 3, 4 ], [