# sx-array-chunk **Repository Path**: phpcoder/sx-array-chunk ## Basic Information - **Project Name**: sx-array-chunk - **Description**: 将一个数组分割成多个 - **Primary Language**: NodeJS - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-21 - **Last Updated**: 2021-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sx-array-chunk #### 介绍 将一个数组分割成多个 #### 安装教程 1. npm i sx-array-chunk #### 使用说明 ```javascript import sxArrayChunk from "sx-array-chunk"; try { const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; console.log(sxArrayChunk(array, 2)); // 返回 [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ] console.log(sxArrayChunk(array, 3)); // 返回 [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ], [ 10 ] ] } catch (error) { console.log(error.message); } ```