js 数组分组chunk

function chunk(arr, size) {
    var result = [];
    for (var i = 0, len = arr.length; i < len; i += size) {
        result.push(arr.slice(i, i + size));
    }
    return result;
}
let rowsGroup = chunk(arr, 500);

 

posted on 2022-03-03 17:31  苹果园dog  阅读(159)  评论(0编辑  收藏  举报

导航