常见数组切割(项目使用)

let chunk = function(arr, num){
num = num*1 || 1;
let ret = [];
arr.forEach(function(item, i){
if(i % num === 0){
ret.push([]);
}
ret[ret.length - 1].push(item);
});
return ret;
};
原文地址:https://www.cnblogs.com/QxkWeb/p/6902052.html