Skip to content

Instantly share code, notes, and snippets.

@fengjunren
fengjunren / group.js
Created November 4, 2022 01:50
[title]数组分组#js
function group(array, subNum) {
let index = 0;
let newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, (index += subNum)));
}
return newArray;
}