配列をn個の要素ずつ分割する
const sliceByNumber = (array, number) => {
const length = Math.ceil(array.length / number)
return new Array(length).fill().map((_, i) =>
array.slice(i * number, (i + 1) * number)
)
}
const sliceByNumber = (array, number) => {
const length = Math.ceil(array.length / number)
return new Array(length).fill().map((_, i) =>
array.slice(i * number, (i + 1) * number)
)
}