Created
November 4, 2022 01:50
-
-
Save fengjunren/f4c3fbd0d33dcb16fded6b656cda1da3 to your computer and use it in GitHub Desktop.
[title]数组分组#js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function group(array, subNum) { | |
let index = 0; | |
let newArray = []; | |
while (index < array.length) { | |
newArray.push(array.slice(index, (index += subNum))); | |
} | |
return newArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment